Fedora Linux Support Community & Resources Center
  #1  
Old 17th November 2004, 03:11 PM
shanec Offline
Registered User
 
Join Date: Nov 2004
Posts: 1
Building a shared library on Fedora Core 2

Hi all,

I have a command-line C program compiled under gcc on my 64 bit fedora core 2 box, all working very well.
Now I wish to package the C source into a shared object, to be called from another java program (java 1.5 for 64 bit linux)

I build my shared object as follows:

gcc -c -fPIC <c source files>
gcc -fPIC -shared <obj files> -o liblibrary.so

...which all works fine. I then put the .so into a place it can be found at runtime.

However, when I run the java project, it successfully kicks off the .so, but crashes in the middle of one of my C routines.

I have recompiled and run the same project on Windows using a DLL, with success. So my suspicions are that I have somehow incorrectly built my .so.

Any help is greatly appreciated,

Shane
Reply With Quote
  #2  
Old 23rd November 2004, 03:45 PM
tashirosgt Offline
Registered User
 
Join Date: Aug 2004
Posts: 3,855
I suppose you could try the -m64 flag. It's an interesting question whether the gcc compiler on a 64 bit machine knows to default so it generates 64 bit code. I've been compling and running programs on mine and never stopped to think about whether I was getting a 64 bit executable! Haven't tried any shared objects.
__________________
"Never let the task you are trying to accomplish distract you from the study of computers."
Reply With Quote
Reply

Tags
building, core, fedora, library, shared

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
what is with all the shared library errors?!!? HMSS013 Using Fedora 8 25th September 2009 04:32 PM
Shared library cajino Using Fedora 2 1st January 2007 09:13 AM
list library function of a shared library .so powah Programming & Packaging 2 26th April 2006 03:50 AM


Current GMT-time: 10:27 (Tuesday, 21-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat