View Full Version : Beginner's question - using DLL

05-25-2005, 04:19 PM
I am trying to port a Linux function to Windows but I do not know how to use a DLL. Can someone tell me what I need to do within the code (or in the compilation command) in order to tell the compiler that a certain function can be found in a dll? The following is a small segment I am trying to port:

#include <GL/glut.h>

void display(void)
// clear all pixels
glFlush ();
int main(int argc, char** argv)
glutInit(&argc, argv);
glutCreateWindow ("hello");
return 0;

BTW, I am using GCC (cygwin) and Eclipse as an interface.

05-25-2005, 04:35 PM
In windows you need a .lib file that will be used for producing the .exe (gets linked to the code) and the actual dll that contains the code. Then your executable knows where in the dll the function resides. If you haven't installed glut for win32 get it from Nate Robbins\' (http://www.xmission.com/~nate) page. He's the one that did the port. I haven't tried compiling opengl with gcc in windows, but the glut header file should include everything you need. (At least for visual studio)
Maybe there's a package of glut for cygwin, then I guess you could just compile as normal probably (-lglut) and the thing should run on windows.
I haven't used Dev-C++ but it seems as a good free alternative for developing opengl in windows, if you don't want to get your hands dirty with Visual Studio. By the way do you, or anyone else know if there's something similar to tabs for switching through open files in vim or emacs? I'm trying to start developing small to medium projects in linux but I still miss stuff from Visual Studio, like tabbed browsing of the open files and the class view.