flat assembler
Message board for the users of flat assembler.
Index
> Windows > Import .lib files |
Author |
|
Tyler 18 Aug 2010, 11:40
> - How does linker know in which DLL file does that function reside?
It doesn't. You have to tell it. Code: section'.idata' import data readable library kernel, "kernel32.dll" import ... |
|||
18 Aug 2010, 11:40 |
|
vid 18 Aug 2010, 11:46
Tyler: You are giving example of FASM "format PE" source, which doesn't use linker at all. I was asking about something different.
|
|||
18 Aug 2010, 11:46 |
|
tutenhamon 18 Aug 2010, 21:46
write file.def
[code] LIBRARY DLL EXPORTS DllHelloWorld [/code] DLL is name of dll library library export 1 function which have a name DllHelloWorld and link with switch /DEF:file.def |
|||
18 Aug 2010, 21:46 |
|
Tyler 19 Aug 2010, 02:01
So you mean how does it know in what static link(.lib, .a) file the function is in?
Well, for ld(Yes, I know, ld is for *nix. But it may give you an idea of how other linkers do it.), it has preconfigured directories it automatically searches when it can't find a function you're trying to link to. There's a flag(-nostdlib) to tell it not to search said directories. I don't know any more specifics than that, but I'm sure Google can help. |
|||
19 Aug 2010, 02:01 |
|
vid 19 Aug 2010, 07:45
Nevermind, I found it. Objects in lib file use a sorting feature of linker ("sectionname$number", eg. ".idata$4") to build up import section. Very clever.
More here: http://www.microsoft.com/msj/0498/hood0498.aspx |
|||
19 Aug 2010, 07:45 |
|
vid 19 Aug 2010, 08:13
However, it seems Microsoft has introduced some kind of "packed lib" format since that article was written. LIB files I have in latest Visual Studio don't contain full COFF objects, only some very short ones, without usual IMAGE_FILE_HEADER and IMAGE_SECTION_HEADERS. Section names are only found once/twice at the end of the LIB file. Anyone has any info about this?
It is a pity Microsofts own tools can't account for this and extract full object file from such LIB. |
|||
19 Aug 2010, 08:13 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.