Making a .dll

This is a discussion on Making a .dll within the C++ Programming forums, part of the General Programming Boards category; Hi i hav Borland compiler and was wondering if any one would tell me how to make a .dll? I ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    11

    Making a .dll

    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.

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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.

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    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)
    {
    }
    Code:
    //Main program
    int main()
    {
    	typedef void(*DoStuffPtr)(void);
    
    	HINSTANCE TheDll=LoadLibrary("library.dll");
    	DoStuffPtr TheFunction=GetProcAddress(TheDll,"DoStuff");
    	TheFunction();
    
    return 0;
    }
    Something like that.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  4. #4
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I think modding may be considered cracking
    Your definition of modding must be way off then.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>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 09:40 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #6
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    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.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  7. #7
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    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

  8. #8
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    That's what I use, but I'm not sure if it works in other compilers.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Making great graphics
    By MadCow257 in forum Game Programming
    Replies: 1
    Last Post: 02-20-2006, 11:59 PM
  2. Making control...
    By Finchie_88 in forum C++ Programming
    Replies: 2
    Last Post: 09-07-2004, 02:42 PM
  3. Problem with a .dll file
    By GaPe in forum Windows Programming
    Replies: 2
    Last Post: 10-29-2003, 01:20 PM
  4. Replies: 2
    Last Post: 01-13-2003, 01:28 PM
  5. About Unix Programming - Making a career desision
    By null in forum C Programming
    Replies: 0
    Last Post: 10-14-2001, 08:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21