Received: from PACIFIC-CARRIER-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA04444; Wed, 20 Dec 95 15:43:12 EST
Received: from liquor.cabi.net by MIT.EDU with SMTP
	id AA10305; Wed, 20 Dec 95 15:43:11 EST
Received: (from listadm@localhost) by liquor.cabi.net (8.6.12/8.6.12) id PAA06676; Wed, 20 Dec 1995 15:00:17 -0500
Resent-Date: Wed, 20 Dec 1995 15:00:17 -0500
Date: Wed, 20 Dec 1995 14:59:59 -0500 (EST)
From: Bradley McLean <bradm@phoenix.silverplatter.com>
To: Randy Chapman <chapman@u.washington.edu>
Cc: Byron Rakitzis <byron@netapp.com>, java-linux@java.blackdown.org
Subject: Re: native methods on Linux?
In-Reply-To: <Pine.OSF.3.91l.951220092233.9482A-100000@saul3.u.washington.edu>
Message-Id: <Pine.LNX.3.91.951220145235.9066B-100000@phoenix.silverplatter.com>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Resent-Message-Id: <"7QDwY.0.ed1.pi6sm"@liquor>
Resent-From: java-linux@java.blackdown.org
X-Mailing-List: <java-linux@java.blackdown.org> archive/latest/774
X-Loop: java-linux@java.blackdown.org
Precedence: list
Resent-Sender: java-linux-request@java.blackdown.org


On Wed, 20 Dec 1995, Randy Chapman wrote:

> 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

A new voice says:  [Thanks for the fine work, Randy!]

Actually, we've been working on this for a few hours; specifically we're 
Java-wrapping the YAZ Z39.50 toolkit.  Perhaps this Makefile Snippet will 
be of use:

---------------------- snip snip --------------------------------
# Makefile for Java Z39.50 YAZ Hack

JAVAHOME=/usr/local/java
OS=solaris      # should be Linux!
YAZDIR=../yaz-1.0
CFLAGS= -I$(JAVAHOME)/include -I$(JAVAHOME)/include/$(OS) -I. 
-I$(YAZDIR)/include

all     : libyaz.so YAZ.class Main.class

libyaz.so : $(YAZDIR)/lib/libyaz.a YAZ.o yaz.o
        mkdir t
        (cd t; ar x ../$(YAZDIR)/lib/libyaz.a)
        cc -shared -o libyaz.so YAZ.o yaz.o t/*.o
        rm -rf t

yaz.o : yaz.c YAZ.h

YAZ.h   : YAZ.class
        javah YAZ

YAZ.c   : YAZ.class
        javah -stubs YAZ

YAZ.class : yaz.java
        javac yaz.java

Main.class : main.java
        javac main.java
--------------------- snip snip --------------------------------

This starts with main.java, yaz.java, and yaz.c, as well as the 
associated underlying library, and succesfully builds.  Note that I'm 
using the solaris header files unmodified.  The .so contains everything I 
need from the pre-existing .a file.

This is with GCC 2.7.2, ld.so 1.7.14, and libc 5.2.16 on a Caldera 
distribution based 1.2.13 kernel on an old 486/66 we had hanging around.

-Brad

Bradley McLean
Software Engineer, US Development
SilverPlatter Information
617 769-2599 ext 287

