Hi Craig,

No, you don't need to compile with -O to build a shared object. But you *do*
need to compile with -fpic to get position-independent code. Then use -shared
when loading the object, as you already do.

I have successfully built a number of shared objects using no other special
options (for use with Tcl rather than Java, but that should make no difference).

BTW to save renaming a.out, use "-o <yourname>.so"

Cheers ... Duncan.

On Fri, May 22, 1998 at 11:48:05PM -0000, Felix Morley Finch wrote:
> >>In article <[EMAIL PROTECTED]>, Craig E Rasmussen 
><[EMAIL PROTECTED]> writes:
>
> > I'm having trouble getting native calls to work.  I'm using JDK-1.1.3
> > and the simple HelloWorld example segfaults.  My guess is that the
> > problem is that I'm not creating the shared objects correctly. I'm
> > using gcc with the -shared option to create an a.out file which I rename
> > to libhello.so.  I think this is not the right thing to do.
>
> I have no idea if or why, but I was told you need to optimize to make
> a dynamic library.  Add -O and see if that helps any.

Reply via email to