Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how2 compile .dll files under Linux (off topic)  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone !
I know this is slightly off topic.
I'm developing an application involving native libraries, written in C, with JNI.
I'm using Linux for developing and everything is running as it should.
Just wondered if I can build .dll libraries under Linux as well, or maybe with Wine ?
I don't wanna install windows and visual c++ !
thanks guysngals,
dennis
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DLL is a windows specific format for a shared library. On unix based systems the extension is .so (for shared object).

There's an example here showing how to compile a .so using GCC.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh sorry, my question was a bit misleading..
I meant, can I create a dll library on Linux, for running my JNI application on Windows ? as far as I know, I can't get it to run under windows with a .so library and whatever i read about it, it always says i have to create the dll with Visual C++ under Windoze and that's what i'm trying to avoid.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... what you're looking for is a cross-compiler. Basically the cross-compiler knows the kind of output it needs to produce for a platform, even though the compiler isn't running on that platform. I found these notes on using MinGW and Cygwin for windows cross-compiling on Linux. (Though I haven't done this myself...)

If you have access to a Windows machine, you don't have to use VC++... I've always used MinGW on windows. They even have an example of how to create a JNI DLL in their FAQ.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks so much for your tip - this is exactly what i was looking for !
respect
dennis
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!