Problem with the png library

Started by
10 comments, last by Game Boy 22 years, 3 months ago
I''m trying to load a png image as a texture. I''m using the glpng library by Ben Wyatt. The problem is when I compile the code in Borland C++ Builder 5, I get a linker error in the official png library: [Linker Error] ''C:\GLPNG[1]\LIB\GLPNG.LIB'' contains invalid OMF record, type 0x21 (possibly COFF) Does anyone know how to fix this?
Advertisement
I''ve never used his library. I haven''t read the license, but most licenses have you shafted for commercial products so I use the original zlib and libpng from www.libpng.org Easy to use and easy to compile, and no limit on the license, its free and they wrote it to begin with. Also has MNG.


Well anyway, back to the topic at hand.


There are TWO ways to get around this (not including giving up)

1st way is to get their source and recompile the library.

2nd way is to do the following. This works for nearly any library that is a linker library to a DLL, ie a library that calls in a DLL file but doesn''t do anything it self. Eg GLUT is one of them. I haven''t seen this Ben Wyatt''s library, but what they are is basically a library that contains function names.

Well anyway, what you do is have your library, lets call it wally.lib
You don''t need this Library any more as it is for a different compiler.

Then you have wally.dll - this you need.

In console (you can do this throught the IDE, but the console - dos box thing - is easier) you locate the dll file.
type
implib wally.lib wally.dll

This will create a new wally.lib. Link with this one instead.


If it crashes after this, then you know that it WASN''T the afore mentioned linking library so you will have to recompile it from the source.





As a foot note, you can also use implib to stick lots calls to the dlls into one library. ie wack in both GLUT, and the SGI GL DLL and some of your own DLLs into one file by using a wild card.

implib my.lib *.dll



Hope this helped you.


Beer - the love catalyst
good ol'' homepage
Beer - the love catalystgood ol' homepage
I seems to get a hint of what the implib command do, form you last post...
can you kinda explain it in more detail?
I think I should make my last ques. more specific.
I am quite new to win32 prog. and I am not sure if I am having a complete understanding on how the library file and dll are relating to each other...say if I find an API somewhere, they usually include headers, libraries, and DLL''s...how are they linked dynamically? if you implib a whole bunch of DLL''s together, do you still call them just by including the same header files???
to your last post. Yes, you still use the same header files. Keep them seperate at first though so you actually know that the imported file is working.


Condensing them is really rather pointless at a whole unless you use the same libraries over and over and you keep on accidently deleting them .

Aslong as you use implib wally.lib wally.dll your program will hopefully work right. I think that guy (ben wyatt) has the source to his library on the page anyway, so even if the import library (what implib comes from) fails, you can just recompile his source.


Beer - the love catalyst
good ol'' homepage
Beer - the love catalystgood ol' homepage
Oh well a bit more info.


Those libraris that you can create with IMPLIB are called IMPORT LIBRARIES. Basically these contain a bunch of references to the DLL file it has to load, and which function to call from it. Each of these is compiled with teh name of a function such as void wally(void) which is declared in something like fred.h.

This is similar to a c file called wally.c but it is basically pre-compiled.

That is why it is called an import library and how they link together.


Sorry if this is VERY general, but I dont'' want to confuse anyone who is starting up.


Beer - the love catalyst
good ol'' homepage
Beer - the love catalystgood ol' homepage
I searched with dir implib*.* /a/s, and can''t find it? does it come with MSVS? or Windows (2k)? (got both installed) or something else?
you aren''t using Borland are you?

The guy who first posted this is using a Borland compiler. All we have to do is type it anywhere as it is in our compiler/bin directory which is in our path. Microsoft compilers MAY have one, and if they do it is probably under a different name.

Borland has had implib in back as far as borland C++ version 2.0 as far as I can recall. Probably further.


Beer - the love catalyst
good ol'' homepage
Beer - the love catalystgood ol' homepage
no, I am using VC++ 6.0
I looked under the bin director and don''t really find anything interesting...maybe except lib.exe...but that''s not it...
thats one of the cool things about doing a dir *.exe /w /p under the bin of borland compilers. You find so much stuff . I remember on version 2.0 when I was looking for BGI stuff (after I got the BGI toolkit - this is the old dos graphics stuff from borland) I found all the implib functions, how to compile to the com files, resource editors, windows help file compiler things and lots more. They are really antiquated now, but they still rocked. Ever since then I have stuck to Borland (and also in the old dos IDE they had fantastic help files which is how I was able to learn the standard C calls so fast).


Beer - the love catalyst
good ol'' homepage
Beer - the love catalystgood ol' homepage

This topic is closed to new replies.

Advertisement