Hello again;
Last year tried to set up PellesC 6.50 as a SDL dev enviroment, and failed miserably
![Embarrassed :-[](https://forum.pellesc.de/Smileys/default/embarrassed.gif)
. After doing all those tutorials say, i've been unable to compile any of the SDL sample programs, always with the 'error: unresolved external symbol' message.
After running around like a chicken with his head cut-off for a while
![Shocked :o](https://forum.pellesc.de/Smileys/default/shocked.gif)
, I deduced that it was the undescoring problem mentioned in
http://forum.pellesc.de/index.php?topic=2809.msg11699#msg11699. Polib creates a NOT UNDERSCORED import library, and the compiler creates UNDERSCORED calls from the headers, thus, when it tries to link, the errors.
Well, a year later, new SDL version, new PellesC version
![Smiley :)](https://forum.pellesc.de/Smileys/default/smiley.gif)
and the same problem
![Sad :(](https://forum.pellesc.de/Smileys/default/sad.gif)
:
1-How can I force polib to underscore the functions? Don't see a flag to do so. If not posible, why not? And a more detailed answer that 'to better match Microsoft', because in VC (Microsoft Visual C) this seems to work with no trouble. Not because I'm demanding, I'm just curious.
![Huh? ???](https://forum.pellesc.de/Smileys/default/huh.gif)
2-How can I force the compiler to NOT underscore the calls? Is there a project option or a macro to be called on the headers to force this? Shouldn't it be?
3-If none of those is possible, it is mentioned that if generating the import library from a DEF definition file of the dll, they are underscored correctly. How can I create the def file? (I mean aside to installed the MS Visual C++ compiler to be able to use the DLL Wizard mentioned there. I doubt my old Toshiba could handle it, even if it had the disk space for it). Is there a small tool for this?
4-If there isn't, shouldn't that functionality be in polib too?
![Roll Eyes ::)](https://forum.pellesc.de/Smileys/default/rolleyes.gif)
And completely unrelated to the previos questions, I have a doubt
![Tongue :P](https://forum.pellesc.de/Smileys/default/tongue.gif)
. When I use polib to /LIST the calls of a static library, all i get are a list of the obj files than make it (with the full path to those on the original machine). Shouldn't it list the functions inside those too?
Please help everyone, sad panda is sad
![Cry :'(](https://forum.pellesc.de/Smileys/default/cry.gif)
-- Edit --
If you wanted me to guess, sorry for being a bit thick (it just took me a year and then some to figure out)
![Cry :'(](https://forum.pellesc.de/Smileys/default/cry.gif)
.
I) Open a command line console: Start > Execute >
cmd.exe
II) Go to the directory where you have a copy of the DLL you want to make the import library.
In my case
cd "%UserProfile%\My documents\Pelles C Projects\SDLdemo
.
III) Create a DEF file of the DLL. To do so, execute:
"%ProgramFiles%\PellesC\Bin\polib.exe" SDL.dll /MACHINE:X86 /OUT:SDL.lib
"%ProgramFiles%\PellesC\Bin\polib.exe" SDL.lib /MACHINE:x86 /MAKEDEF:SDL.def
"%ProgramFiles%\PellesC\Bin\polib.exe" SDL.lib /LIST
type SDL.def
IV) As you were shown by the two last commands, both the lib and the def file are NOT underscored. So that lib file won't link. Delete it.
delete SDL.lib
V) Recreate the lib file from the not-underscored def file like this:
"%ProgramFiles%\PellesC\Bin\polib.exe" SDL.lib /MACHINE:x86 /DEF:SDL.def
"%ProgramFiles%\PellesC\Bin\polib.exe" SDL.lib /LIST
As you have been shown, this lib file is automagically underscored.
To prove it, I've compiled several SDL examples that come with the code, and they have compiled and worked alright.
I hope they help someone, out there, in the depth of the internets.