Exporting Engine
I''ve just begun to write my own 3d-engine in OpenGL, and I wonder if there''s a way to export the main engine (initialization and so on) to an external DLL?
If, how do i include that DLL in my next engine?
//Metus
Ethereal
A DLL is basically just a module of compiled code (just like an EXE file) that cannot be run, and that gives you access to certain functions inside it. If you want to put the engine in a DLL, you just need to create a DLL project in your IDE, and put the functions into the file. Then, you have to declare them in a header file like this:
#ifdef _DLL
#define DLLEXPORT export
#else
#define DLLEXPORT import
#endif
and declare your functions like this:
int _declspec(DLLEXPORT) Function1();
That way, when you are building the DLL and have _DLL defined, the functions will be declared export, and when you are building your program (with the headers included to declare the functions) you will have the functions as being imported. (I''m pretty sure that''s the syntax, but you should look up _declspec for the exact stuff).
Then, when you build a DLL, it will generate an import library which you should add to the projects of the programs you write using the DLLs.
Another way is to use LoadLibrary, which you should look up in your help files.
This probably isn''t that good of an explanation, because I don''t know all that much about it myself.
Hope this helps!
------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
#ifdef _DLL
#define DLLEXPORT export
#else
#define DLLEXPORT import
#endif
and declare your functions like this:
int _declspec(DLLEXPORT) Function1();
That way, when you are building the DLL and have _DLL defined, the functions will be declared export, and when you are building your program (with the headers included to declare the functions) you will have the functions as being imported. (I''m pretty sure that''s the syntax, but you should look up _declspec for the exact stuff).
Then, when you build a DLL, it will generate an import library which you should add to the projects of the programs you write using the DLLs.
Another way is to use LoadLibrary, which you should look up in your help files.
This probably isn''t that good of an explanation, because I don''t know all that much about it myself.
Hope this helps!
------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement