1

Okay so I have a bunch of .dll files that are compiled on windows (though I could recompile them on linux if that was necessary) that I want to use.

The final idea I am having is to write a .so that will be able to call the functions defined in the dlls.

As far as I have read this should be possible by using mono but I just can't seem to find any resource on how that might actually work. And by that I mean a specific example demonstrating the basics.

So let's assume I have a .dll that contains a function called getText() that will return the String "Hello World" when called.
How can I write my C++ code (I want it to be compiled to a .so so that's what I have to use, right?) that it calls that function and prints the returned String to the console? Is this even possible?

If the above scenario isn't possible: How can I use mono in general to access dlls? I have already written a C# example that does the job but ultimately I need a .so so this is not an option. Might there be some way to use mono from the command line to execute the function?


Another thing I found is the loadlibrary framework which seems to be capable of what I am looking for. However I have no clue how I would use it, so I'd appreciate a little code-example

  • the loadlibrary framework site has an example mpscript.c .... looks like the dll file has to be copied from windows to the engine sub-directory ...... just read the whole webpage ..... github.com/taviso/loadlibrary – jsotola Jan 8 at 18:23
  • If I understand correctly, linux cannot use dll files directly, but it works (with some dll files and in general with some Windows programs) with the interface program wine. See www.winehq.org - What is Wine?. Another 'almost' alternative is CygWin. – sudodus Jan 8 at 19:18
  • @jsotola thanks for pointing me to the website. I'll habe a look at this. – Raven Jan 8 at 21:14
  • @sudodus for my specific case I don't think that wine is an option but I'll have a look at CygWin – Raven Jan 8 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.