delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/03/24/05:43:44

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Mon, 24 Mar 2003 18:43:21 +0800 (GMT-8)
From: Sim Joon <esim AT comp DOT nus DOT edu DOT sg>
To: cygwin AT cygwin DOT com
Subject: Linking VC++ DLL
Message-ID: <Pine.GSO.4.21.0303241837570.9209-100000@sf0.comp.nus.edu.sg>
MIME-Version: 1.0

Hi,

I have already compiled and linked the following function

extern "C" __declspec(dllexport) int hello()
{
	printf("Hello World!\n");
	return 345;
}

in a VC++ DLL.

I have also successfully linked and created the import library in Cygwin,
libhallo.a

However,
when I compile and run the following code
using
gcc hello.c -lhallo

extern int hello();

int main()
{
	printf("What is this? %d\n", hello());
}

All I get in return is (under Cygwin):
What is this? 345

345 demonstrates that the function was called and correctly returned but
why is it that the printf statement in the function hello() went missing?
I have tried to run other VC compiled program but had no problem in
getting printf statements to work under the Cygwin environment. Would
appreciate if anyone can suggest what could be the possible
problem. Thanks!

regards
Edward



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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