From: colin AT bird DOT fu DOT is DOT saga-u DOT ac DOT jp (Colin Peters) Subject: RE: Re[2]: Linking with .LIB files 28 Mar 1997 02:20:28 -0800 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <01BC3AA2.3D63E0C0.cygnus.gnu-win32@gbird0> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Original-To: "'David W Palmer'" Original-Cc: "'GNU-Win32'" Original-Sender: owner-gnu-win32 AT cygnus DOT com David W Palmer[SMTP:David_W_Palmer AT ccm DOT jf DOT intel DOT com] wrote: > For those who are watching: Colin Peter's text is left justified, mine is > indented. > >David W Palmer[SMTP:David_W_Palmer AT ccm DOT jf DOT intel DOT com] wrote: >Although this may be secondary to your concerns, or in fact may be >totally off topic, I notice that libglu32.a and libopengl32.a are >both included with the beta 17.1 distribution. I'm not sure about >the header files, but if you can get your code to compile you should >be able to link it with ld. Of course this doesn't help if what you >really want is DirectX or some other thing that comes with .lib >files you can't convert to .a files. > > Actually, that is interesting. From the distribution I downloaded, > libglu32.a and libopengl32.a are not available. However, I am > interested in the general problem of linking with MS lib's (ie, > glaux.lib). > > I suspect that I could use dlltool to generate an import library for > glu32.dll and opengl32.dll. I'll give it a try. Actually I've got libglaux.a as well. Hang on a second and I'll look at my original copy... they are definitely there. So it doesn't seem I generated them myself later. In the original tarball I found them in H-i386-cygwin32/i386-cygwin32/lib. Interestingly some of these (but not all) have .def files included in the original Win32-API 0.1.2 package. In the Cygnus source distribution the def files appear in src/winsup/sysdef/i386, and that should be all of them. But back to the question of linking with .libs that you can't get a .a for... >> LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup [snip: include crt0.o?] > //f/pgming/OpenGL/simple$ make > link simple.o crt0.o libuser32.a glu32.lib opengl32.lib libgdi32.a > /subsystem:windows /machine:i386 > crt0.o : error LNK2001: unresolved external symbol _cygwin_crt0 Hmm, that would be in libcygwin32.a if I remember correctly. > So, I can trade WinMainCRTStartup() for cygwin_crt0(). Not much > progress. Though, this has to be defined somewhere! Which library? > Unfortunately, I don't know how to list the functions in a library. > (how embarrassing) :+( You can get a list of functions in a library fairly easily by using nm (which lists symbol names): nm libfoo.a | grep T Of course with sed and awk, or possibly the correct options to nm (!) you can probably get cleaner output, but this is a useful first cut. I often use nm libfoo.a | grep foobar to see if foobar is in the foo library. > BTW: instead of defining WinMainCRTStartup(), it's easier to use the > link option /ENTRY:mainCRTStartup. This is true. It seems from following other threads on this matter that the whole effort may be doomed by some sort of "offset problem" people seem to have with programs linked this way. Although my memory may be failing me again. I have some information which leads me to believe a bug in gas (or as if you like; the assembler) may hurt your chances of getting this to work. But anyway, good luck, Colin. -- Colin Peters - colin AT bird DOT fu DOT is DOT saga-u DOT ac DOT jp -- Saga University Dept. of Information Science -- http://www.fu.is.saga-u.ac.jp/~colin/index.html -- http://www.geocities.com/Tokyo/Towers/6162/ - For help on using this list, send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".