Subject: Re[3]: Visual Studio linking
From: Alastair Growcott <[email-masked]>
To: [email-masked]
Date: Wed, 2 Jun 2004 13:15:24 +0100 (GMT Daylight Time)

Ok, so progress so far. By the way, a main reason I am posting this stuff is so that in future anyone trying the same can search the archives and find all these posts. If anyone reads it and actually helps me, that would be a bonus :)

I now have what seems to be a proper import library for cygwin1.dll. I am stuck as to what  entry point I should specify. I expected cygwin1.dll to implement mainCRTStartup, and have seen guides that suggest that when compiling programs under cygwin using gcc, that you should specify manCRTStartup as the entry point with the -e option.

I have found that crt0.o implements mainCRTStartup(). Can anyone tell me what crt0.o is for? However when I take that as well it then demands a symbol _cygwin_crt0 which is defined in libc.a. If I take libc.a as well then I get loads of undefined symbols which seem to be defined in libgcc.a somehow.

If I specify main() as my entry point, I get it to compile with only those warnings about the wrong attributes on the .text sections. However when I try and run it, it just hangs. Running it through gdb and breaking it gives me the following stack;

0x7c5b9a91 in UnregisterConsoleIME ()
   from /cygdrive/c/WINNT/system32/KERNEL32.DLL

Of course, this is probably wrong.

I suspect that some of the people who wrote Cygwin could probably tell me exactly what I need to do or why it is impossible and save me stumbling around blindly like this. The question is, do they read this mailing list?

Alastair.

On Wed, 2 Jun 2004 10:17:18 +0100 (GMT Daylight Time) Alastair Growcott <[email-masked]> wrote:

> So far so good - not.
> 
> I am trying to link against the lib*.a files using the Visual Studio linker, and it seems to accept them. However I do get the following warning;
> 
>     libcygwin.a(d001126.o) : warning LNK4078: multiple '.text' sections found with different attributes (E0000020)
> 
> Moreover when I try and run the executable, absolutely nothing happens.
> 
> Now I remember reading somewhere that MSVCRT.DLL and cygwin1.dll are mutually exclusive, so I flange my makefile to add /NODEFAULTLIB on the link line. I now get the additional message;
> 
>     LINK : error LNK2001: unresolved external symbol _mainCRTStartup
> 
> I know this is simple to fix, but my brain has just gone to sleep - any tips?
> 
> Alastair.
> 
> 
> On Wed, 2 Jun 2004 09:51:52 +0100 Max Bowsher <[email-masked]> wrote:
> 
> > Alastair Growcott wrote:
> > > Hi.
> > >
> > > I have read all the FAQs and stuff. I have searched the web. I would like
> > a
> > > step by step list of instructions to achieve the following.
> > >
> > > I want to use check to test an MFC application. This means I must use the
> > > Visual Studio compiler, cl, and linker, link.
> > > Check calls fork(). This function is implemented in the cygwin1.dll.
> > > I cannot link using the DLL. I read somewhere that libcygwin.a is
> > equivalent
> > > to the cygwin1.lib, but when I try and link against it I get all sorts of
> > > bizarre symbols not found. According to cygcheck, cygwin1.dll only has
> > > dependencies on standard Windows DLLs that I am already linking against.
> > >
> > > So how do I;
> > >
> > > a) obtain a version of cygwin1.lib that I can link against using the
> > Visual
> > > Studio linker that will work nicely and neatly, or
> > > b) link against libcygwin.a using the Visual Studio linker.
> > 
> > I don't think anyone has ever done this before, so I doubt very much whether
> > what you are looking for exists.
> > 
> > If you are serious about doing this, you will likely need to figure it out
> > yourself, assuming of course, that it actually is possible at all.
> > 
> > Max.
> > 
> > 
> 
> 
> 
> 

-- 
Alastair Growcott
Software Maintenance Engineer

BakBone Software
Merck House
Seldown Lane
Poole, BH15 1TW
P +44 (0)1202 241000
F +44 (0)1202 249000
[email-masked]
www.bakbone.com
> 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/