I have no idea how to create DLLs or how theyre used? How do you load one in an application? How do you create one?(Borland command line compiler) If they store functions, why cant you just use a header file? Thanks for the help !!!
I have no idea how to create DLLs or how theyre used? How do you load one in an application? How do you create one?(Borland command line compiler) If they store functions, why cant you just use a header file? Thanks for the help !!!
Do not make direct eye contact with me.
I honestly can't tell you cause I don't know a thing about it, but you can always find help either on this board just do a google search.
I found this thread that may help you to some extent.
http://cboard.cprogramming.com/showt...&highlight=dll
Knowledge is power and I want it all
-0RealityFusion0-
dlls are linked at run time. They can be used by multiple applications, and are only stored once.
Stuff in header files finds its way into the final .exe - making the .exe bigger. It also can't be reused by another program without including it all again - meaning that it will end up being stored twice, in two big exes.
Think of it like this:
with dlls:
two little exe files, and one dll
without dlls:
two big exe files
Away.
Just to get a tad more specific (on the search):
http://cboard.cprogramming.com/searc...der=descending
*Note*: I noticed this is not in the new FAQ. If i knew anything on the topic i would create a section for it, but i dont. Maybe someone can write a DLL section for the FAQ and send it to hammer?
Well, dll's are windows dynamic link libraries. Hence, since they are windows oriented, they are not a part of the standard library. So everything I mention here is nonstandard and won't be portable (without modifications).
Basically, a dll contains compiled code, similar to an exe. However, unlike an exe, multiple programs can use the code in a dll. It is just a matter of loading the dll. This is done through pLoadLibraryEx. Once you load the dll, you must load each function into a function pointer. This is done by calling GetProcAddress. Once the function is loaded into the function pointer, the function pointer can be used just like any function.
When creating a dll in C++, there are some special calling conventions you must follow. In C++, when you compile code, the compiler "mangles" the name of the functions, variables, etc. As a result, if the names were mangled in a dll, the exe calling the dll wouldn't be able to find the function. Hence, the funky extern "C" stuff.
EDIT: Make sure you call [url="http://msdn.microsoft.com/library/en-us/dllproc/base/freelibrary.asp?frame=true"]FreeLibrary when you are done using a dll in your program.
Last edited by golfinguy4; 08-08-2003 at 10:07 PM.