This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

problems mixing msvc objects with gnu-win32 objects


Hi,

I have just installed the gnu-win32 stuff onto my machine (b18 with Sergey's cygwin.dll).
Compiling and binding small programs using only the gnu-win32 stuff works fine. But now I have to
add modules created my msvc with modules created by gnu-win32. This means I have libraries containing
.obj modules and .o modules. Also the sources containing main should be compiled with both compilers.
Testing this mixture I made some small examples. Some of them work others not.
Here is a small working example :

example_1.c (will be linked using ld with libanw.a) :
-----------------------------------------------------

#include <stdio.h>
void main(argc, argv)
int argc;
char *argv[];
{
        int status;
        char name[255];
        status = ReadHostname(name);
        if( status == 0 )
        {
                printf("hostname : %s\n",name);
        }
        return;
}

up_1.c (will be added to libanw.a using ar) :
---------------------------------------------

#include <stdio.h>
int ReadHostname(char *name)
{
        int     status;
        status = gethostname(name,50);
        if( status != 0 )
        {
                printf("ReadHostname() : error %d from gethostname()\n",status);
        }
        return status;
}

This example works even compiled with msvc or gnu-win32. It Works also if the sources are
compiled with different compilers.
Changing the line 

                printf("ReadHostname() : error %d from gethostname()\n",status);

in up_1.c to 

                fprintf(stderr,"ReadHostname() : error %d from gethostname()\n",status);'

and compiling it with msvc I can't bind the program anymore.

error using ld :
----------------

./libanw.a(readhostname.obj)(.text+0x2e):readhostname.c: undefined reference to `_iob'

error using link :
------------------

error LNK2001: unresolved external symbol _gethostname

I am yust a newbie using nt and gnu-win32 having no experience with this effects. But I 
think I am not the only one who has/had these problems.
Any ideas / answers to the described problems ?


Regards,

Thomas


------------------------------------------------------------------------------------------
Thomas Vetter                                   Phone:  +49 69 6649 2415
Cegelec AEG Systems                             FAX:    +49 69 6649 2261
Abt.: A/RD 1
Lyoner Str. 9                                   e-mail: vetter@aat-f.aeg-f.de
60528 Frankfurt                                 WWW:    http://thomasvetter.aat-f.aeg-f.de
Germany                      
------------------------------------------------------------------------------------------
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]