Hi. I'm just starting out in programming a video game DLL. Once I get the first version compiled and running I think I'll be fine, but I need a little help right now. Through online tutorials, I've compiled a (hopefully) working "test.dll", and my program can find it, but I don't know the code to link and execute a test function in the DLL. Can anyone give me a hand? Is there a website that goes over how to program a DLL? Thanks.
I'm working on Dev-C++ version 4, running on Windows XP.
Here's one of many threads you'll find by searching these forums.
When you create a DLL project, and compile it, it will produce 2 files in the release folder. One will be named test.dll and the other will be test.lib. You link test.lib to your application's project under the settign for additional libraries and then have test.dll in the same directory as YourGame.exe. The lib file produced automagically handles loading the DLL at runtime. There is a manual way to load the DLL functions, but I dont recommend it, especially since you have the lib already compiled for you.
Actually I just noticed you said you are using Dev-C++, it still produces a library file just as VS does, but it has a different extension. I think its .a instead of .lib it should be in the same directory that the DLL was compiled into.
Many thanks. I've found "maindll.o" , now how do I link it to Dev-C++ ?
I tried menu:Options->Compiler Options->Add the following commands when calling compiler ,
but don't know the syntax for adding a library. "maindll.o" "-lmaindll.o" "-l maindll.o" and "-maindll.o" all didn't work. What am I doing wrong?