This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Creating a shared library does not work for me.


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]