Received: from PACIFIC-CARRIER-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA21378; Wed, 20 Dec 95 12:58:00 EST
Received: from liquor.cabi.net by MIT.EDU with SMTP
	id AA13203; Wed, 20 Dec 95 12:58:00 EST
Received: (from listadm@localhost) by liquor.cabi.net (8.6.12/8.6.12) id MAA02966; Wed, 20 Dec 1995 12:26:50 -0500
Resent-Date: Wed, 20 Dec 1995 12:26:50 -0500
X-Sender: chapman@saul3.u.washington.edu
Date: Wed, 20 Dec 1995 09:26:18 -0800 (PST)
From: Randy Chapman <chapman@u.washington.edu>
To: Byron Rakitzis <byron@netapp.com>
Cc: java-linux@java.blackdown.org
Subject: Re: native methods on Linux?
In-Reply-To: <9512201654.AA00771@lada>
Message-Id: <Pine.OSF.3.91l.951220092233.9482A-100000@saul3.u.washington.edu>
Foo: foo-bar
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Resent-Message-Id: <"MpY9-2.0.fj.oS4sm"@liquor>
Resent-From: java-linux@java.blackdown.org
X-Mailing-List: <java-linux@java.blackdown.org> archive/latest/767
X-Loop: java-linux@java.blackdown.org
Precedence: list
Resent-Sender: java-linux-request@java.blackdown.org

On Wed, 20 Dec 1995, Byron Rakitzis wrote:

> Hi, I am a newcomer to Java and Linux both. I would like to compile
> native methods for java-linux, but I am having a hard time puzzling
> things out.

I think you're also the first person other than me to try to do it.
And I have the java source, so thats not quite fair ;-p

> First of all, there do not seem to be linux-dependent header files,
> the equivalent of "include/solaris/typedefs_md.h". I am making my best
> guess at what the linux equivalent should be, mostly the uncertainties
> lie in the details of 64 bit int support.

Its pretty much the same as the solaris version.  I notice that
there is a include/solaris/typedefs_md.h in the archive, how does
that work?  If I neglected to replace that with the linux version
(certainly quite possible), the differences were pretty small.

> Second of all, there has to be some way for an object file to be loaded
> at runtime by java-linux. I saw a reference on the java-linux web page
> to a DLD package, but a pointer to a cookbook on how to put DLD and
> java-linux together would be most appreciated.

DLD is for aout crap.  This is ELF here.  You just need to make a shared
library pretty much the same way you would make any other ELF shared library:

gcc -fPIC -rdynamic -c foo1.c
gcc -fPIC -rdynamic -c stubs.c
gcc -fPIC -rdynamic -o libfoo.so foo1.o stubs.o

And then be sure libfoo.so is in your LD_LIBRARY_PATH

> I can do this myself if I have to, but I hate reinventing wheels.

Quite.

> Your help is much appreciated.

Sure.  Please keep me updated on how this works.  Once this is straightened
out, it really ought to go into the HOWTO...

--randy

