[Mono-dev] File not found error when using Activator.CreateInstanceFrom()

Jonathan Pryor jonpryor at vt.edu
Wed Jan 19 11:48:24 EST 2011

On Jan 18, 2011, at 4:52 PM, mike wrote:
> Hey Jonathan P,  I noticed that u wrote the 'Interop with Native Libraries'
> article on the mono web site. Very good stuff. I have a question, can mono
> link or inter op to a Linux static library instead of a shared object? (i.e
> mylib.a)

_Maybe_. :-)

This won't work:

	[DllImport ("mylib.a")]
	static extern void Foo();

That won't work because dlopen(3) is used to load the specified library, and dlopen("mylib.a") will fail.

HOWEVER, if you're using the Mono embedding API, write a native app, and link your native app to mylib.a:

	gcc -o yourapp yourapp.c mylib.a `pkg-config --cflags mono-2` ...

Then you can do:

	[DllImport ("__Internal")
	static extern void Foo();

See also:


 - Jon

More information about the Mono-devel-list mailing list