I need help to compile a script ("iterator.c") into a DLL. I can't use VS2010 since it does not support the features added to C in the C99 standard (I'm using "complex.h" but VB doesn't support it).
I've been looking for a substitute but all I've found is GCC which I don't know how to install/use (really, I've spent like half an hour reading through the documentation and I don't even understand how am I supposed to install it), and Cygwin, which I've already installed but I don't know how to use either. Also, I've installed MinGW but I think it's the same as Cygwin more or less, and I still don't know how to make a DLL.
It's not like I've been all lazy and haven't even tried it, it's just that these compilers aren't like nothing I've ever used before (mostly Python IDLE and Visual Studio, which make things pretty easy for you). I'm kind of lost.
Could someone give me some advice on how to use this tools to make a DLL that I can access from another script? It is really important.
You must place __declspec(dllexport) in front of the method you wish to export such as, you could #define this to max it easier
EXPORT_DLL void hello() { ... }
To compile the dll use
gcc -c -mno-cygwin mydll.c
gcc -shared -o mydll.dll mydll.o -Wl,--out-implib,libmylib.dll.a
then to attach
gcc -o myexe.exe test.o mydll.dll
EDIT: Forgot the most important piece, you need to make a mydll.h file to include your method definition so the compiler knows to reserve a spot for the linker to fill in later on. It's as simple as
#ifndef MYDLL_H
#define MYDLL_H
extern "C" __declspec(dllexport)
#define EXPORT_DLL __declspec(dllexport)
EXPORT_DLL void hello();
#endif