Creation of import libraries for Windows

Phil Lavoie maidenphil at hotmail.com
Thu Jan 10 09:29:07 PST 2013


Hi all,

This is actually a duplicate of my post on the D.learn forums :).
I am concerned that it hasn't been answered only because it is in 
a less popular sub forum. I'll try to make it short.

This websites recommends implib for the creation of import 
library therefore I have been using it. When I compile + link my 
code containing "extern( Windows )" function declarations, I get 
the following messages:
Error 42: Symbol Undefined _functionName at ordinal (generic case)
Error 42: Symbol Undefined _glGetIntegerv at 8 (just an example)

Let's hypothesize that I am using "shared.dll" and I would like 
to "statically" link against it using an import library. I use 
this command: implib /noi /system shared.lib ..\shared.dll
To generate the import library. Once done, I make sure the linker 
finds it and rebuild the program. I get the same errors.

Therefore, I looked into the import library only to find that no 
exported symbols have and ordinal appended (@someInt), CONTRARILY 
to the symbols you can find in the import library provided by the 
compiler (..\D\windows\lib\*).

So... how were those generated in the first place (what makes 
them have those ordinals, was this an automated process or did 
someone actually wrote the module definition files by hand)? How 
and why is extern( Windows ) generating symbol calls expecting 
ordinals for stdcall conventions (how does it know that 
_glGetIntegerv has an ordinal of 8 for example)? Is the ordinal a 
desirable requirement for those calls?

Thanks,
Phil




More information about the Digitalmars-d mailing list