|
Trying to create a shared library
Hi,
I have a Java Program which utilizes the native C Code on Red Hat Linux. When I compile the C code to produce a shared library using the following command:
cc -I <header_file_Location> -I <platformspecific_Headerfile> <programname>.c -o <shared_lib_name>.so
I get the below error:
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start':
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
This is certain 'coz <programname>.c doesn't have a main function.
Later I tried with an alternate option:
cc -I /space/j2sdk/include -I /space/j2sdk/include/linux -c HelloWorldImp.c
This produced the object file.
Now I used the option:
cc <programname>.o -o libxyz.so
But still I get the same error.
Can any1 help me out.
Thanks in advance.
Thanks,
Mukund
|