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.
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; }
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
Your definition of modding must be way off then.I think modding may be considered cracking
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
>>I think modding may be considered cracking
>Your definition of modding must be way off then.
Yub yub. Think Counter-Strike
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?
Last edited by Hunter2; 07-24-2004 at 08:40 PM.
Just Google It. √
(\ /)
( . .)
c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.
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.
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
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.
If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein
That's what I use, but I'm not sure if it works in other compilers.
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials