java app using newlisp.dll ?

Started by HPW, September 14, 2013, 11:18:20 PM

Previous topic - Next topic

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

#1
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

#2
Hello,



Sounds very interesting. Thanks for the info.

Future will tell us.



Regards
Hans-Peter

HPW

#3
Here is also an interesting project: JNA



https://github.com/twall/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

#4
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">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.