java app using newlisp.dll ?

Q&A's, tips, howto's
Locked
HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

java app using newlisp.dll ?

Post by HPW »

Hello,

Is it possible to write a windows-Java app (jar) which uses newlisp.dll as ist engine ?

The newlisp IDE is a Java app, but uses newlisp.exe in a separate process and communicates with it.
(I see 2 processes in the taskmanager)

So can I use Java like other enviroments with embedded newlisp within one process?
Callback-Support?
Sample?

Regards
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: java app using newlisp.dll ?

Post by Lutz »

To import the newLISP C library to Java, a Java Native Interface (JNI) would have to be added to access the newlisp shared library. Currently there are no plans implement this, but it is on my list of things to do in the future.

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Re: java app using newlisp.dll ?

Post by HPW »

Hello,

Sounds very interesting. Thanks for the info.
Future will tell us.

Regards
Hans-Peter

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Re: java app using newlisp.dll ?

Post by HPW »

Here is also an interesting project: JNA

https://github.com/twall/jna

As a java newbee I have no idea if this can be used with newlisp.

Regards
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: java app using newlisp.dll ?

Post by Lutz »

Yes, you should definitely be able to use JNA on an unmodified newlisp.dll (standard calling conventions) or newlisp.dylib or newlisp.so (C calling conventions - cdecl). You would use newlispEvalStr in Java as a function taking a Java String type and returning a Java String type. You could probably do this without using https://github.com/twall/jna as you just deal with one or two functions, which have to be setup once. Callbacks using newlispCallback are probably possible too. newlispCallback would take String, Pointer and int or long and return Pointer.

Locked