LinPAC with JNA (JAVA Native Access)

Visit the JNA download page: https://repo1.maven.org/maven2/net/java/dev/jna/jna/  for download jna-x.x.x.jar --  jna-5.2.0.jar for exammple.

The following program loads the local C standard library implementation and uses it to call the printf function.

0. Adding dymanic linker in makefile , and rebuild the library file - libi8k.a to become a share library.

all:    $(libdir)/$(PJ).a $(libdir)/$(PJ).so

$(libdir)/$(PJ).a: $(SRCS)
        $(CC) -c $(CFLAGS) $?
        $(AR) $(ARFLAGS) $@ *.o
#       rm -f *.o

$(libdir)/$(PJ).so: $(SRCS)
        $(CC) -shared -Wl,-soname,$(PJ).so -o $@.0.1 *.o
        rm -f *.o


1. Create a soft link: libi8k.so.0.1  symbolic link to libi8k.so.0.1 and libi8k.so


2. Compile demo (HelloWorld.class)
javac  -cp  jna-5.2.0.jar   HelloWorld.java

3. Execute
3.1 windows -> using JNA calling msvcrt.dll, and declare the printf() function
java   -cp   jna-5.2.0.jar;. HelloWorld
==> LinPAC will display "Hello, World"

3.2 Linux -> using JNA calling libc.so, and declare the printf() function
java  -cp  jna-5.2.0.jar:. HelloWorld
==> LinPAC will display "Hello, World"

More detail information, please refert to:
https://en.wikipedia.org/wiki/Java_Native_Access