Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: From: "Svensson, Paul" To: "'cygwin AT sourceware DOT cygnus DOT com'" Subject: Problems linking WinAPI calls Date: Wed, 22 Sep 1999 10:19:46 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain I'm trying to port a medium-sized project over from Unix to NT, and have so far managed to compile with Cygwin; the next step being to replace Cygwin-specific calls in the code with the corresponding native NT code. However, when trying to do this, the linker can't find any of the Windows functions. As far as I can understand the documentation at the Cygwin web page, the code below should work, and I have also tried various combinations of -mwindows, -lkernel32, etc, without improving anything. What confuses me is that the sql libs I built myself, from the .LIB files shipped with oracle, work perfectly fine, while the kernel32.a shipped with Cygwin does not. Doing an nm on the files, I see that the kernel32.dll has names with @NN appended (varying NN), which the sql libs don't. This seems significant, but I can't figure out how to convince the linker to find the right stuff. I wanted to try to build my own kernel32.a from the system KERNEL32.LIB, but running nm on that fails after a few lines, with nm: KERNEL32.dll: File format not recognized. Right now, I'm stumped. Any pointers, workarounds, or ideas where to look for more information would be greatly appreciated. ---------------------------------------------------------------------------- ---- gcc -ansi -pedantic -Wall -Wunused -Wstrict-prototypes -Wpointer-arith \ -Wwrite-strings -Wmissing-declarations -Wnested-externs \ -finline-functions -fstrength-reduce -g -o \ /usr/src/plaza/build/bin/filerd.exe \ /usr/src/plaza/build/obj/filerd/def.o \ /usr/src/plaza/build/obj/filerd/main.o \ /usr/src/plaza/build/obj/filerd/param.o \ /usr/src/plaza/build/obj/filerd/poll.o \ /usr/src/plaza/build/obj/filerd/timestamp.o \ /usr/src/plaza/build/obj/filerd/writefile.o \ /usr/src/plaza/build/lib/sqllib80.a /usr/src/plaza/build/lib/sqxlib80.a \ /usr/src/plaza/build/lib/libplaza.a -lcygipc /usr/src/plaza/build/obj/filerd/main.o: In function `main': /usr/src/plaza/src/filerd/main.c:100: undefined reference to `OpenFile' /usr/src/plaza/build/lib/libplaza.a(shm.o): In function `attach_shm': /usr/src/plaza/src/libplaza/shm.c:48: undefined reference to `CreateFileForMapping' /usr/src/plaza/src/libplaza/shm.c:57: undefined reference to `GetLastError' /usr/src/plaza/src/libplaza/shm.c:59: undefined reference to `CreateFileMappingA' /usr/src/plaza/src/libplaza/shm.c:62: undefined reference to `CloseHandle' /usr/src/plaza/src/libplaza/shm.c:66: undefined reference to `MapViewOfFile' /usr/src/plaza/src/libplaza/shm.c:69: undefined reference to `CloseHandle' /usr/src/plaza/src/libplaza/shm.c:70: undefined reference to `CloseHandle' collect2: ld returned 1 exit status ---------------------------------------------------------------------------- ---- /Paul -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com