Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com List-Unsubscribe: List-Archive: List-Help: , Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <19990808215808.51691.qmail@hotmail.com> X-Originating-IP: [151.13.75.185] From: "Emanuele ALIBERTI" To: cygwin AT sourceware DOT cygnus DOT com Subject: Re: Dlls @n symbols Date: Sun, 08 Aug 1999 14:58:07 PDT Mime-Version: 1.0 Content-Type: text/plain; format=flowed I solved most problems I had with generating clean (undecorated) exports tables for my DLLs thanks to the suggestions by Mumit. For the special problem of forwarded symbols in the exports table, DJ suggested to compile the current binutils snapshot. I downloaded it but... ehm... could not compile (egcs 1.1.2/mingw32). But I browsed the code and now understand a bit more what the correct syntax should be for achiving that. I'll make an example to let someone comment if I say something wrong, omit a necessary step or do something redundant. Imagine I want to rewrite the NT's kernel32.dll. It is a good and easy example, because it forwards some symbols to ntdll.dll. That is (among the others): HeapAlloc --> NTDLL.RtlAllocateHeap HeapFree --> NTDLL.RtlFreeHeap HeapReAlloc --> NTDLL.RtlReAllocateHeap HeapSize --> NTDLL.RtlSizeHeap Now I need writing two DEF files, one to build the import library (kernel32.def), and one to build the exports table (kernel32.edf). Here is a possible kernel32.edf LIBRARY KERNEL32 IMPORTS RtlAllocateHeap=NTDLL.RtlAllocateHeap RtlFreeHeap=NTDLL.RtlFreeHeap RtlReAllocateHeap=NTDLL.RtlReAllocateHeap RtlSizeHeap=NTDLL.RtlSizeHeap ... EXPORTS ... HeapAlloc=RtlAllocateHeap HeapFree=RtlFreeHeap HeapReAlloc=RtlReAllocateHeap HeapSize=RtlSizeHeap ... and here is the twin kernel32.def LIBRARY KERNEL32 IMPORTS RtlAllocateHeap=NTDLL.RtlAllocateHeap RtlFreeHeap=NTDLL.RtlFreeHeap RtlReAllocateHeap=NTDLL.RtlReAllocateHeap RtlSizeHeap=NTDLL.RtlSizeHeap ... EXPORTS ... HeapAlloc AT 12=RtlAllocateHeap HeapCompact AT 8 HeapCreate AT 12 HeapCreateTagsW AT 16 HeapDestroy AT 4 HeapExtend AT 16 HeapFree AT 12=RtlFreeHeap HeapLock AT 4 HeapQueryTagW AT 20 HeapReAlloc AT 16=RtlReAllocateHeap HeapSize AT 12=RtlSizeHeap HeapSummary AT 12 HeapUnlock AT 4 HeapUsage AT 20 HeapValidate AT 12 HeapWalk AT 8 ... These files work fine even with the current bintools. This means the changes DJ reported are not in the parser. In fact, if I actually try to build a DLL with that DEF, I get gcc \ -specs=k32_specs \ -mdll \ -o junk.tmp \ -Wl,--base-file,base.tmp \ kernel32.o \ ../ntdll/ntdll.a kernel32.o(.text+0x4bf):env.c: undefined reference to `HeapAlloc AT 12' kernel32.o(.text+0x4d3):env.c: undefined reference to `HeapAlloc AT 12' kernel32.o(.text+0x6a0):env.c: undefined reference to `HeapFree AT 12' kernel32.o(.text+0x6cc):env.c: undefined reference to `HeapFree AT 12' kernel32.o(.text+0x4870):dir.c: undefined reference to `HeapAlloc AT 12' kernel32.o(.text+0x490d):dir.c: undefined reference to `HeapFree AT 12' kernel32.o(.text+0x4a01):dir.c: undefined reference to `HeapAlloc AT 12' kernel32.o(.text+0x4a9d):dir.c: undefined reference to `HeapFree AT 12' kernel32.o(.text+0x5c83):find.c: undefined reference to `HeapAlloc AT 12' kernel32.o(.text+0x5e87):find.c: undefined reference to `HeapFree AT 12' make[1]: *** [kernel32.dll] Error 1 (the kernel32.dll rewriting is actually a real project). This is an expected result, since the HeapXXX function were removed from the kernel32 sources. The question is: the unresolved reference errors appear because of stdcall decoration, or because the dlltool (ld) can not handle forwarded symbols (assuming my DEFs are correct)? Thank you in advance for any answer (in the list). -e- ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com