delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/02/26/11:15:30

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
To: cygwin AT cygwin DOT com
From: "alexeik AT nordlines DOT ru" <alexeik AT nordlines DOT ru>
Subject: Creating a shared library does not work for me.
Date: Sat, 26 Feb 2005 19:07:55 +0300
Lines: 52
Message-ID: <cvq6h2$7hl$1@sea.gmane.org>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: 62.117.127.37
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041217
X-Gmane-MailScanner: Found to be clean
X-Gmane-MailScanner: Found to be clean
X-Gmane-MailScanner-SpamScore: s
X-MailScanner-From: goc-cygwin AT m DOT gmane DOT org
X-MailScanner-To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

Hello, Everybody.

Maybe I am in wrong group, sorry for this - please point me to correct 
one. Anyway...

I am trying to do an example from Osborne GCC, The Complete Refference 
about creating a shared library under cygwin.

I have:

#include <stdio.h>
void shellofirst(void) {
	printf("The first\n");
}

#include <stdio.h>
void shellosecond(void) {
	printf("The second \n");
}

//stwohellos.c
void shellofirst(void);
void shellosecond(void);
int main() {
	shellofirst();
	shellosecond();
	return(0);
}

and the shell:
gcc -c -fpic -shared shellofirst.c shellosecond.c
gcc -shared shellofirst.o shellosecond.o -o hello.so
gcc stwohellos.c hello.so -o hello.exe

when I run that shell, I have:

$ ./xxxx.sh
cc1: warning: -fpic ignored for target (all code is position independent)
cc1: warning: -fpic ignored for target (all code is position independent)
hello.so(.text+0x0):crtstuff.c: multiple definition of `___do_sjlj_init'
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/crtbegin.o(.text+0x0):crtstuff.c: 
first de
fined here
collect2: ld returned 1 exit status

Interestingly, that if I remove a 'shellosecond.c' -- I have success.

What I am doing wrong?

With best regards,

Alexei Kozlov


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