[Mono-bugs] [Bug 660015] Getting errors and crash while invoking Activator.CreateInstanceFrom()
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Dec 23 12:37:50 EST 2010
https://bugzilla.novell.com/show_bug.cgi?id=660015
https://bugzilla.novell.com/show_bug.cgi?id=660015#c3
--- Comment #3 from mike guman <mguman at knology.net> 2010-12-23 17:37:49 UTC ---
Luis,
Ok, rewrote to use p/Invoke with a true native DLL (extern C, no name mangling
here) and it appears that I am back to *square one* with the 'File not found
exception'.
If I p/Invoke to a single native dll, all is fine. However if that dll depends
on a secondary native
dll, I get an "unhandled exception: System.DLLNotFoundException". Again, this
scenario works fine under
NET, fails under 2.8
The issue seems to be related to p/Invoking to a dynamic link library which
depends on a second native dll.
Here is a tiny example of all codes involved which may help highlight the
issue. Note the native dlls
are in a sub-folder 'native' to the executing app path.
--------------------------------------------------------------------------
First DLL (Test_Native.dll) source :
//------------
// MyLib.h
//------------
#pragma once
extern "C" {
_declspec(dllexport) void Test();
}
//----------
//MyLib.cpp
//----------
#include <iostream>
#include <stdio.h>
#include <exception>
#include "MyLib.h"
#include "MyEnviron.h"
using namespace std;
void Test()
{
foo();
printf("ok.");
}
Second DLL (Environ.dll) Source:
//-------------------
//MyEnviron.h
//-------------------
extern "C" { __declspec(dllexport) void foo(); }
//-------------------
//MyEnviron.cpp
//-------------------
#include <iostream>
#include <stdio.h>
#include <exception>
#include "MyEnviron.h"
using namespace std;
void foo()
{
printf("dyn ok.");
}
// Test C# driver
//
//------------------
using System;
using System.Runtime.InteropServices;
using System.IO;
namespace PInvoke_Test
{
class MainClass
{
public static void Main (string[] args)
{
_Test();
}
// Test Method
[DllImport("Native\\Test_Native.dll",
EntryPoint = "Test",
ExactSpelling = false,
CallingConvention = CallingConvention.StdCall)]
static extern void _Test();
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list