is there some version of kernel32.lib without call wrappers? (eg. it only contains reference to external __imp__ExitProcess@4, without _ExitProcess@4)
Posted on 2006-11-06 04:49:58 by vid
Dunno - why? :)

You could probably build one yourself, shouldn't be too much work either spitting out coff directly, or perhaps using fasm as backend if you're lazy. But, apart from slightly smaller .lib size, what's the point?

(Also note that some .lib files have both imports and code/data, so you can't just build those from a definition file...)
Posted on 2006-11-06 09:03:08 by f0dder
originally i wanted it because i use call [__imp__ExitProcess]  calling, instead of call _ExitProcess where _ExitProcess does jmp [__imp__ExitProcess]. This way is little more flexible, and also takes less space.

but later i realized that in case of FASMLIB (for which i was wanting this), it's on caller to provide __imp__ symbols anyway, in way he likes
Posted on 2006-11-06 09:39:03 by vid
I can't see this reducing the size of the program much, the jump table would probably still be allocated so there would be no savings there, even if it wasn't it only represents a few hundred bytes at best, nothing to write home about. Also you would think that it would slow down load times as the number of relocations would increase by a wide margin, the PELoader would be required to do multiple relocations where previously only 1 was sufficient. You can always bypass the "double jmp" by calling the address in the jump table directly.
Posted on 2006-11-06 23:17:10 by donkey

You can always bypass the "double jmp" by calling the address in the jump table directly.
that's what i'm doing.

PS: you can't use direct call for APIs. API addresses are imported, not relocated
Posted on 2006-11-07 02:20:34 by vid
You can take a guess at the relocated address , but it MAY be incorrect.. I wouldn't go that way if I was you.
Posted on 2006-11-07 08:51:37 by Homer
donkey: relocations will only be done for DLLs (unless you're writing tricky code on purpose), and only DLLs that can't be loaded at their base address. And the "jump dword " will only be included if it's referenced.

But still, it's not much saving you get. And if you have many calls to a particular API, the direct call approach will actually be larger... do the maths yourself :)
Posted on 2006-11-07 09:22:18 by f0dder