Search code examples
javac#linuxjni4net

How do I call a .Net dll (function) from Java on mono/linux


As the subject says, is this possible? I know of jni4net but its on windows.

Heres an excerpt of the error I get:

Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /tmp/mydll.dll which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Native code library failed to load.

Solution

  • You may want to create a function in C that is called from the Java code, and that calls your C# function in return.

    Have a look here for the C to C# bridge.