As far as I understand.. libs and combined into the EXE so you have a standalone program. DLLS are used at runtime and are seperate so you can share them.
So how come with gapidraw103 there is a LIB and a DLL and you must use both?
Why can't I link to the lib and have a standalone program without the DLL?
can someone straighten out my thinking on this?
Yes a Lib is combined into the .exe, and Dll's are set outside for smaller codebase/reuse. When you use a Dll, there has to be some way for the compiler to know whats inside of it, so you need to still have a .lib file(though much smaller than a full blown lib that wouldn't require a dll). So, All Dlls require a Lib, but all libs dont require a Dll ;).
To expand on that, there are basically 3 different combinations:
1) Static Linking. In this case there is no DLL, and the code from the LIB is integrated directly into the app.
2) Shared DLL, statically linked. This requires both a LIB (for linking) and DLL (for runtime), and is the most common method of linking to a DLL. The downside is that if the DLL (or any of the required routines) cannot be found, the app will fail to load. Programmatically you access DLL routines in the exact same manner as any other function you would link to statically (which makes it very transparent).
3) Shared DLL, dynamically linked. This is how I access gx.dll. You don't even need to link to a LIB file (this is how you call routines in DLLs you do not have a LIB for, hint hint). I dynamically load the DLL at initialization (LoadLibrary), and obtain pointers to all the needed procedures (GetProcAddress), which requires a little extra work up front. This allows me to display a robust error message stating that gx.dll cannot be found and where the user can get it, as well as the potential to revert down to standard windows GDI calls and bypass GAPI altogether. I would think all GAPI libraries (Frog, EasyCE, GAPIDraw, etc) would access gx.dll in this manner. Take a look at the Pocket Quake source for an example.
Dan East
so where does making you lib cross platform come into play? iof I wanted to make a 3d lib for linux and win32 I am guessing I would use either method 2 or 3?
Gapidraw seems to use method 2 (correct me if I am wrong)
Method 2 seems a waste since it requires a lib and a DLL.. is there a advantage to this over method 1 and 3 ?
What if I want one stand alone file and a dll is provided.. is this impossible?
thanks for th ereply.. its helping me understand why tI cannot get these 2d engines to compile and link right
Hi,
Basically there are three advantages of (2) over (1) and (3). The first one is less storage requirements if you have multiple games that all use the same DLL (10 small GapiDraw games on one smartphone = 1mb less space). The other is that it makes it possible to "bundle" the DLL with existing PDAs and Smartphones in ROM (very possible with the new 48mb flash PDAs). The last one is that it makes it easy for us to track the use of GapiDraw.
Linking issues etc will always be there no matter if the library is statically linkable or a shared DLL.
/Johan
so is the MFC class dlls included in PPC 2002 rom?
I am not sure wether to program in MFC or not at the moment but if it is already there then I guess there is no harm
Yes, they are already in ROM.
Dan East