[Mono-list] Call C# .dll from java on linux using mono ?

Jonathan Pryor jonpryor at vt.edu
Mon Dec 20 11:05:05 EST 2010

On Dec 20, 2010, at 6:38 AM, AngeReveur wrote:
>  I have a C# .dll which I would like to call from a java application on
> linux ? Is this thing possible using Mono ?

Yes, but it isn't easy.  You'd basically need to write a JNI library that uses the mono embedding API to invoke managed code.  It would be fairly straightforward and do-able, but it isn't a "general" solution (to support invoking ~any managed type), not by any means.

It _might_ be easier to run your Java app in IKVM, which runs under Mono.  IKVM provides tools to generate "stub .jar files" from an assembly, so that Java code can compile against managed code "normally"; the .jar files merely contain "stubs" where all the methods are 'native', and IKVM patches things up at runtime.

 - Jon

More information about the Mono-list mailing list