Page 1 of 1

java app using newlisp.dll ?

Posted: Sun Sep 15, 2013 6:18 am
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

Re: java app using newlisp.dll ?

Posted: Tue Oct 01, 2013 6:40 pm
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.

Re: java app using newlisp.dll ?

Posted: Tue Oct 01, 2013 9:03 pm
by HPW
Hello,

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

Regards

Re: java app using newlisp.dll ?

Posted: Mon Oct 07, 2013 1:02 pm
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

Re: java app using newlisp.dll ?

Posted: Mon Oct 07, 2013 4:59 pm
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.