Using external libraries with JUCE, cross-platform

Hi,

I am using JUCE for an application for some physics research. I develop on Linux, and the application requires an ODE solver, so I chose GSL (the GNU Scientific Library). I had no trouble getting this to work in the Introjucer, getting the compiler to find the headers and libraries.

Now I need to recompile this project for Windows, and I am having a lot of difficulties getting it to work. The GSL page says they have a version on Windows with Cygwin. So I installed Cygwin, installed the libgsl package in Cygwin, and have been trying to get Visual Studio to link to this, just by editing the options in the Introjucer. Disaster, right? Eventually I downloaded the source package for libgsl and compiled it in Cygwin; this didn’t help. The best I can do is that my code will compile–I can get it to find the headers–but not link. It’s looking for gsl.obj; I’ve been able to find or make libgsl.a and libgsl.dll.a, but I can’t get those to work.

I think what I’m supposed to do is tell my software to dynamically link to libgsl.dll, but I don’t know how to tell the Introjucer to tell Visual Studio to do this. And if I did, where would I put the dll? Next to the executable? Would I rename it to libgsl.dll instead of libgsl.dll.a?

I apologize if I’m making a dumb mistake, but I have very little development experience on Windows.

Thanks,
Sauraen

A static library under Unix is typically a .a file and the "lib" preface is left off.

A static library under Windows is typically a .lib file and there is no automatic preface to ignore.

A dynamic library under windows is a .dll file (dynamic link library). Don't futz with the name. The file must also either been in the system path or sitting in the same folder as your executable (not your source code, but the actual .exe file being executed in Debug\ or Release\).

There are two basic ways to use a DLL. You can statically link to it, or dynamically load it with Win32 API calls like LoadLibrary() and GetProcAddress(). Static linking is the easiest. Usually, in addition to creating a DLL, a build will also create a .lib file. This .lib is just a stub, with references to the DLL, which is linked to the program like any other static library.

Good Luck,

-jjf