[Mono-dev] File not found error when using Activator.CreateInstanceFrom()
Jonathan Pryor
jonpryor at vt.edu
Fri Dec 17 12:13:37 EST 2010
On Dec 16, 2010, at 3:24 PM, mike wrote:
> Thanks for the reply. Here is an example attached driver (test.cs) which
> calls the Activator.CreateInstanceFrom(). Runs fine under NET 2.0 but bombs
> under mono 2.8 with the 'implement type compare for 1b!' error message. You
> will need to construct asmall native C++ dll with a matching class name and
> constructor to call.
On .NET, you're _not_ invoking a "native C++ DLL," you're invoking a C++/CLI DLL. (It must be this way, as a normal native C++ DLL will use tons of compiler-specific name mangling for the types and namespaces, so "mycplusplusnamespace.mycplusplusclass" has no chance of working, ever, on any platform, unless the runtime directly supports native C++ code, which would likely make it specific to a particular C++ compiler, thus somewhat defeating the point of the CLR...)
Mono does NOT support C++/CLI assemblies, hence the error you see.
In short, Don't Do That, avoid C++/CLI and use P/Invoke instead if you want to run on Mono under any platform other than Windows.
(Or, compile your C++/CLI assembly with /clr:pure so that it isn't a mixed-mode assembly and instead consists solely of IL. How practical this is depends upon your code.)
- Jon
More information about the Mono-devel-list
mailing list