Author Topic: Need some info about DLLs  (Read 5109 times)

bro

  • Guest
Need some info about DLLs
« on: July 15, 2008, 12:11:23 pm »
Hello guys,

i am a student in computer science enginering and i am up for my final work. It's about raster graphic with OpenGL and c++. In my studyies i always used the standard c++ library so i am new to library problems. It's 2 days i am trying to understand how the compiler/linker/loader work. At the moment i am using vista+CB 8.02+minGW.

Well for my OpenGL applications i use GLUT. To use glut i found a nice tutorial, pretty easy: copyied the .h and the .lib respectively in the include and lib diresctoryies of my minGW installation. Copyied the DLL in Windows/system. And in the project->build options->linker settings tab i added the glut32.lib file without any "other linker option". It works right, but i'd like to khnow why i did all this stuff.

The problem begins since now i have to use a lib called libpng (which depends on zlib). I tought to follow the same steps used for glut. I dloaded the development files. In this package there a lot of files but (not only just 1 .lib, 1 .h and 1 .dll as glut).

1) For example in the lib dir of pnglib i have .dll.a and .lib files. I read on google "The format mingw uses for static libraries is the .a file". Why don't i use a .a file installing glut? Just because it's a dynamic lib and .a files are just for static ones? If .a files are "designed" for minGW do i need a minGW version for a library or are libraries good for every kind of compiler?

2) There are static and dynamic libs (DLL). For dynamic ones, the object code (binary code) contains some unresolved symbol wich is solved only at runtime time. If in a package i see a DLL file is it a dynamic lib or might be a static one too? Are the installation steps different for DLL and static libs? 

3) What means "i'd reccomend building both libpng and zlib from source"? Sounds like "take the c++ code and compile it" to my eyes. Am i right?

I can't find solutions for my questions. i.e. on the wiki there is a lot of stuff but it speaks in general about compiling, linking and more. There is no tip on the installation issue, how i (from CB i.e.) i can link to a library.

Any kind of help is really appreciated!
Thanks
Bro

bro

  • Guest
Re: Need some info about DLLs
« Reply #1 on: July 15, 2008, 02:25:48 pm »
Hey there,

i found a nice post from MortenMacFly where he explains in wich way he manages his libs.

I did this:

- created a new dir called DevPacks C:\Program Files\CodeBlocks

- added zlib and libpng folders. Now i have this structure:

         C:\Program Files\CodeBlocks\DevPacks\libpng\include
         C:\Program Files\CodeBlocks\DevPacks\libpng\lib
         C:\Program Files\CodeBlocks\DevPacks\zlib\include
         C:\Program Files\CodeBlocks\DevPacks\zlib\lib

- created a new empty project

- from Project->build options->search directories i added the 2 paths C:\Program Files\CodeBlocks\DevPacks\libpng\include  and  C:\Program Files\CodeBlocks\DevPacks\zlib\include in the compiler tab and the 2 paths C:\Program Files\CodeBlocks\DevPacks\libpng\lib and  C:\Program Files\CodeBlocks\DevPacks\zlib\lib in the linker tab.

- later from linker settings tab i added the 2 libs, just adding the names without path since i specified 'em before. I added libpng and libz. (Staying at what Morten says CB should khnow what file (.a or .dll.a) to pick up and i don't need to take care of this)

Now i can compile without error, but when i run it the application doesn't run since CB can't find libpng3.dll (note the 3)! Where the hell can i take this dll and where shoul i put it? I saw many ppl putting DLLs in windows/system, tough other ppl says this is not a good practice.

EDIT: i added the zlib.dll in windows/system. I don't khnow but where i can find that libpng3.dll. Such file doesnt exist. I have just the libpng.dll

Thanks guys, i feel i am near the solution :D
Bro
       
« Last Edit: July 15, 2008, 05:00:20 pm by bro »