Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <004f01c0da1d$09b9c450$d2823bd5@dima> From: "Dmitry Timoshkov" To: Subject: Linking with "stdcall" library Date: Fri, 11 May 2001 21:18:42 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Hello all. Sorry if it was already answered before. But reading faq.txt didn't help. This time I'm experimenting with creating library which does export functions with stdcall naming convention. I *really* need to create and use them, so it's not an option to use cdecl instead. Here is the description what I do: I created test-dll.def file: -- start of test-dll.def -- EXPORTS MyCloseHandle -- end of test-dll.def -- then I created import library libtest-dll.a using dlltool: dlltool --add-stdcall-alias --input-def test-dll.def --output-lib libtest-dll.a then I created test-gcc.c source which uses function exported by libtest-dll: -- start of test-gcc.c -- #define __stdcall __attribute__((__stdcall__)) extern void __stdcall MyCloseHandle(int handle); int main(void) { MyCloseHandle(-1); return 0; } -- end of test-gcc.c -- then I compile test-gcc.c and try to link it with import library libtest-dll.a: gcc -c -O2 -Wall -o test-gcc.o test-gcc.c gcc -o test-gcc2 -Wl,--enable-stdcall-fixup test-gcc.o -L. -ltest-dll test-gcc.o(.text+0x11):test-gcc.c: undefined reference to `MyCloseHandle AT 4' collect2: ld returned 1 exit status It seems that --enable-stdcall-fixup doesn't help. Why? Replacing MyCloseHandle in test-dll.def by MyCloseHandle AT 4 makes linker happy. By it is not the right fix. Any suggestions? Thanks in advance. -- Dmitry. -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple