delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/12/16/00:15:37

X-Spam-Check-By: sourceware.org
Message-ID: <89c3ea2b0612152114u5150ecfara058c41a00a70dac@mail.gmail.com>
Date: Sat, 16 Dec 2006 00:14:52 -0500
From: "andy wang" <ypwangreg AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: how to compile the .so to allow extern functions
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

Hi,  All

I want to compile a .so which contains extern function that may be
defined on the main program.
The following file can be compiled on linux without any problem but
how to compile it on cygwin?

$ cat bug1.c
//this will be .so and will call an extern func1() in the main proc
int func1();
int myfunc()
{
  printf("in myfunc.so");
  func1();
}

$ gcc -o bug1.so -shared bug1.c
/cygdrive/c/DOCUME~1/Flyiky/LOCALS~1/Temp/ccBB7v0l.o:
bug1.c:(.text+0x13): undefined reference to `_func1'
collect2: ld returned 1 exit status

Thanks in advance!

Regards,
Andy

--
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/

- Raw text -


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