Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

MDI

DevIL and DevCPP

This topic is 5668 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know how to get the DevIL to link under Dev-CPP? I''m pretty sure I''ve got the wrong libraries for use with it, but where can I obtain the ".a" libraries for use in it? Currently I''m using the ".lib" libraries from the Windows SDK. TIA.

Share this post


Link to post
Share on other sites
Advertisement
Have a look here:
http://www.gamedev.net/community/forums/topic.asp?topic_id=99884

Or skip to the big finish and grab the files here:
http://www.decoder.dk/prog/download/

it''s only ver 1.6.1 - I''ve haven''t had the time to convert the latest (ver 1.6.5)... ( reads: im lazy )

/Please excuse my bad spelling - My native language is binary not english
|Visit me
\Take my advice - I don''''t use it...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The following can be found at http://www.mingw.org/mingwfaq.shtml#faq-msvcdll. It works, but yo must read it <b>ALL</b> and follow the steps.

Begin--------------

How can an MSVC program call a MinGW DLL, and vice versa?

Assume we have a testdll.h, testdll.c, and testmain.c. In the first case, we will compile testdll.c with MinGW, and let the MSVC-compiled testmain call it. You should use

gcc -shared -o testdll.dll testdll.c \
-Wl,--output-def,testdll.def,--out-implib,libtestdll.a

to produce the DLL and DEF files. MSVC cannot use the MinGW library, but since you have already the DEF file you may easily produce one by the Microsoft LIB tool:

lib /machine:i386 /def:testdll.def

Once you have testdll.lib, it is trivial to produce the executable with MSVC:

cl testmain.c testdll.lib

Now for MinGW programs calling an MSVC DLL. We have two methods. One way is to specify the LIB files directly on the command line after the main program. For example, after

cl /LD testdll.c

use

gcc -o testmain testmain.c testdll.lib

The other way is to produce the .a files for GCC. For __cdecl functions (in most cases), it is simple: you only need to apply the reimp tool from Anders Norlander (since his web site is no longer available, you may choose to download here a version enhanced by Jose Fonseca):

reimp testdll.lib
gcc -o testmain testmain.c -L. -ltestdll

However, for __stdcall functions, the above method does not work. For MSVC will prefix an underscore to __stdcall functions while MinGW will not. The right way is to produce the DEF file using the pexports tool from http://www.is.lg.ua/~paul/devel/binutils.html and filter off the first underscore by sed:

pexports testdll.dll | sed "s/^_//" > testdll.def

Then, when using dlltool to produce the import library, add `-U'' to the command line:

dlltool -U -d testdll.def -l libtestdll.a

And now, you can proceed in the usual way:

gcc -o testmain testmain.c -L. -ltestdll

Hooray, we got it.

Share this post


Link to post
Share on other sites
quote:
Original post by guppy
Have a look here:
http://www.gamedev.net/community/forums/topic.asp?topic_id=99884

Or skip to the big finish and grab the files here:
http://www.decoder.dk/prog/download/

it''s only ver 1.6.1 - I''ve haven''t had the time to convert the latest (ver 1.6.5)... ( reads: im lazy )

/Please excuse my bad spelling - My native language is binary not english
|Visit me
\Take my advice - I don''t use it...


Ahh, thanks for that.

AP also, thanks for the information. I''m having to use DevCPP at home as I use it at college for my project too. Under normal circumstances I''d use MSVC.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!