Creating a shared library does not work for me.

alexeik@nordlines.ru alexeik@nordlines.ru
Sun Feb 27 08:49:00 GMT 2005


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/



More information about the Cygwin mailing list