delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/07/11/09:36:27

From: vs_tv AT aat-f DOT aeg-f DOT de (Thomas Vetter)
Subject: problems mixing msvc objects with gnu-win32 objects
11 Jul 1997 09:36:27 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199707110746.JAA14428.cygnus.gnu-win32@frss27.aat-f.aeg-f.de>
Original-To: gnu-win32 AT cygnus DOT com
Original-Cc: vetter AT aat-f DOT aeg-f DOT de
X-Sun-Charset: US-ASCII
Original-Sender: owner-gnu-win32 AT cygnus DOT com

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 AT aat-f DOT aeg-f DOT 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019