Hi i hav Borland compiler and was wondering if any one would tell me how to make a .dll? I want to begin modding and have been making console .exes for awhile but for this i need to make a .dll.
Thx for any help.
Printable View
Hi i hav Borland compiler and was wondering if any one would tell me how to make a .dll? I want to begin modding and have been making console .exes for awhile but for this i need to make a .dll.
Thx for any help.
It varies from compiler to compiler - exactly which one are you using? And is it for Windows or DOS? Also - I think modding may be considered cracking, and they are quite strict with rules against that here.
I'm not sure about the specifics of your compiler, but I can tell you the aproximate steps. Create a new DLL project, code your functions, and compile. Place this DLL in the working directory of your other project. At some point in that project, call LoadLibrary() and then GetProcAddress() to access specific functions. You'll have to learn a little bit about function pointers to do that, but it's not hard. Alternatively, you could import the functions into your project, which could be easier depending on your program. Here is a little example of the first option:
Code://DLL source file for "libary.dll"
void DoStuff(void)
{
}
Something like that.Code://Main program
int main()
{
typedef void(*DoStuffPtr)(void);
HINSTANCE TheDll=LoadLibrary("library.dll");
DoStuffPtr TheFunction=GetProcAddress(TheDll,"DoStuff");
TheFunction();
return 0;
}
Your definition of modding must be way off then.Quote:
I think modding may be considered cracking
>>I think modding may be considered cracking
>Your definition of modding must be way off then.
Yub yub. Think Counter-Strike :D
But what you said about just declaring/defining the files normally except in a DLL project, isn't there something about having to use extern 'C' before the function name if you want it to be usable, or something to that effect?
I'll have to check that out. I haven't actually used the LoadLibrary() and GetProcessAddress() method, I've only read about it. Importing the symbols in requires compiler-specific commands I believe.
This may not be very helpful, because I haven't compiled a dll in a long time. With VC++ 6.0, I used __declspec( dllexport ) when declaring my functions to define the DLL's interface.
That's what I use, but I'm not sure if it works in other compilers.