C language > Expert questions

Import Libraries

(1/2) > >>

RotateRight:
Is is possible to combine import libraries?

What I would like to do is use polib or polink
to combine

kernel32.lib gdi32.lib user32.lib

and get something like mylib.lib.

Even better would be someway of
combining DEF files.

Vortex:

--- Code: ---polib /OUT:mylib.lib kernel32.lib user32.lib gdi32.lib
--- End code ---

RotateRight:
Vortex,

Thanks for responding.
You of all people can help me figure this out.
Love your tools!


// Hello.c

#include <windows.h>

void EntryPoint(void);

void EntryPoint(void)
{
    MessageBox(NULL, "Text", "Caption", MB_OK);
    ExitProcess(0);
}

.. Compile.bat output

C:\Hello>set PATH=\PellesC\Bin

C:\Hello>set INCLUDE=\PellesC\Include;\PellesC\Include\Win

C:\Hello>pocc  -Tx86-coff -Ot -W1 -Gz -Ze Hello.c

C:\Hello>polib /OUT:mylib.lib \PellesC\Lib\Win\kernel32.lib \PellesC\Lib\Win\use
r32.lib \PellesC\Lib\Win\gdi32.lib
POLIB: warning: '__NULL_IMPORT_DESCRIPTOR' already defined in 'KERNEL32.dll'; ig
noring definition in 'USER32.dll'.
POLIB: warning: '__NULL_IMPORT_DESCRIPTOR' already defined in 'KERNEL32.dll'; ig
noring definition in 'GDI32.dll'.

C:\Hello>polink /ENTRY:_EntryPoint@0 /NODEFAULTLIB /SUBSYSTEM:WINDOWS /OUT:Hello
.exe Hello.obj .\mylib.lib
POLINK: error: Symbol 'mylib:.idata$2' is multiply defined ('mylib.lib(USER32.dl
l)' and 'mylib.lib(KERNEL32.dll)').

C:\Hello>pause
Press any key to continue . . .

RotateRight:
Another valiant effort.


--- Code: ---; kernel32.def

LIBRARY kernel32
EXPORTS
"_ExitProcess@4"
--- End code ---


--- Code: ---; user32.def

LIBRARY user32
EXPORTS
"_MessageBoxA@16"
--- End code ---


--- Code: ---G:\>polib /OUT:mylib.lib /DEF:kernel32.def /DEF:user32.def /MACHINE:X86

G:\>polink /ENTRY:_EntryPoint@0 /NODEFAULTLIB /SUBSYSTEM:WINDOWS /OUT:Hello.exe
Hello.obj .\mylib.lib
--- End code ---

WoHooh it compiled!!

But,



Looking at mylib.lib in notepad,
there is no reference to kernel32.


Pelle:
This is not possibly - today, at least.

Using multiple /DEF options to POLIB will combine all symbols seen, but only the last LIBRARY name will be used to build the import library; all symbols will be associated with this (DLL) LIBRARY name. The next release will warn about conflicting LIBRARY names from multiple module-definition files, but otherwise the current behaviour will remain.

Combining multiple import libraries (LIB files) also fails because of the non-unique symbol '__NULL_IMPORT_DESCRIPTOR' used by Microsoft (the failure comes at link time). This could possibly be fixed by special code, but since I don't think combining import libraries is very useful/important/interesting, I will not waste much time on this. If it's really easy to fix, I will add something in the next release, otherwise I will not bother...

Navigation

[0] Message Index

[#] Next page

Go to full version