newlisp.DLL possible?

Started by HPW, October 13, 2003, 12:30:58 PM

Previous topic - Next topic

Lutz

#15
Think I got everything working, a little change was necessary to avoid printing to the console and return the error string from the DLL instead. I still want to make some other changes and then we will have a new development release on Wednesday.



Lutz

adamss3

#16
Okay.  If you post those changes or email them to me, I can still do some testig.

HPW

#17
I hope we then get the compiled DLL (for the people without the C-compiler).

The readme is promising.
Hans-Peter

Lutz

#18
There is a newlisp_7311.tgz in the development directory, which has just the changes and additional files for making a DLL.



Don't forget to 'make clean' between making the newlisp.exe and newlisp.dll. I n a later step we can try to make a combined newlisp.exe which also can serve as a DLL.



Lutz

HPW

#19
>Don't forget to 'make clean' between making the newlisp.exe and newlisp.dll.



I forgot it! :-)



Some first observation:



(get-string (dllEvalStr "(string(main-args))"))



gives a crash. I assume a DLL can not have main-args.



(get-string (dllEvalStr "(load "test1.lsp")"))



gives a crash. Maybe the double-quotes.



(get-string (dllEvalStr "(load "test1.lsp")"))



returns "true" but does not evaluate the expression inside the lsp "(setq a10)".
Hans-Peter

Lutz

#20
There is a newlisp_7312.tgz in the development directory, it takes care of crashing in 'main-args' and 'print', both are now suppressed and will be ignored in DLL's. newlisp.dll now passes the QA suite which is not 100% but tests most features of newLISP.



Certain math exceptions i.e. (sqrt -1) result in a correct result of 'NaN', but the DLL pops up a Windows messge box, which has to be acknowledged.



Lutz

HPW

#21
Yep, in 7.3.12 problem with main-args is solved.



But this remains:



(get-string (dllEvalStr "(load "test1.lsp")"))



gives a crash. Maybe the double-quotes.



(get-string (dllEvalStr "(load "test1.lsp")"))



returns "true" but does not evaluate the expression inside the lsp "(setq a 10)".



Here a remains nil.
Hans-Peter

HPW

#22
As a quick hack I put together a neobook-plugin (delphi) for newlisp.

(hpwNewLISP.nbp 33KB Interface-DLL binded into neobook runtime)



In the past I have made some free plugins for the authoring package neobook.

I have a plugin running to call corman DLL's.



http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/neobook.html">http://hpwickern.bei.t-online.de/anmeld ... obook.html">http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/neobook.html



I upload a demo-exe to my plugin-page:



http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISP.zip">http://hpwickern.bei.t-online.de/anmeld ... ewLISP.zip">http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISP.zip



Question: Is it in the interest of newLisp to release this to the neobook community to spread the word about newlisp to more people?
Hans-Peter

Lutz

#23
Remember that all code you execute runs in the environment of newlisp.dll. After loading you 'test1.lsp' which has (setq a 10) do a:



(get-string (dllEvalStr "a")) => "10"



Also, instead of:



(get-string (dllEvalStr "(load "test1.lsp")"))



you can also do for less quote clutter:



(get-string (dllEvalStr {(load "test1.lsp")}))



About the crash:



When putting "(load "test.lsp")" as argment to dllEvalStr, it really receives 3 args: "(load " , test.lsp and ")". This will mess up the call stack in the DLL, where the function expects only one argument. Fixing this would require a lot of overhead when importing functions. Right now imported functions in newLISP are very fast.



When using the DLL from other Win32 applications, this will not be an issue, as all of these to extensive checking and declaring.



In newLISP it is always recommended to put wrappers around imported functions to check for the right type and number of args if these get exposed to users.



The next version will also have fix from Steve/adamss3 for the popup problem with FP exceptions.



Lutz

HPW

#24
>Remember that all code you execute runs in the environment of newlisp.dll. After loading you 'test1.lsp' which has (setq a 10) do a:



Of cource you are right. Have not thought much before posting.

Thanks for clearing. Nice advice for less quote clutter.



Seems to be another great thing with the DLL feature.

I like it very much.
Hans-Peter

HPW

#25
Just try to pack newlisp.DLL with ASPACK:



189 to 97 KB



and it still works! ;-)
Hans-Peter

Lutz

#26
Just tried you demo, very nice, what you can do with Delphi and newLISP together, this may be the best option to deliver GUI heavy applications with newLISP. A user in Sweden wrote a commercial app this way but communicating with newLISP via TCP/IP:  http://www.succeed.se/">http://www.succeed.se/



Just a little observation:



(string (eval a)" "(eval b)" "(eval c))



you could just say:



(string a " " b " " c)



Because 'string' evaluates its args before stringing them together.



Lutz

HPW

#27
>... what you can do with Delphi and newLISP together,



In this case it's delphi in indirekt case. neobook is developed with delphi and therefor the native interface language (SDK) is delphi. Others are possible. So neobook provides a easy to use enviroment and a scripting language. So combined with a lisp-engine a lot of things are possible. But it has not the true dynamic features like the TK-enviroment.



> (string (eval a)" "(eval b)" "(eval c))

> (string a " " b " " c)



Thanks, I had copied it from a corman demo.





And Question again: Is it in the interest of newLisp (and yours) to release the DLL-wrapper to the neobook community to spread the word about newlisp to more people?
Hans-Peter

Lutz

#28
HPW >>>

And Question again: Is it in the interest of newLisp (and yours) to release the DLL-wrapper to the neobook community to spread the word about newlisp to more people?

<<<



Yes, absolutely!



Lutz

HPW

#29
Just released a initial release of the newlisp-wrapper for neobook:



See Froum post:



http://www.neosoftware.com/cgi-bin/ikonboard/topic.cgi?forum=3&topic=390">http://www.neosoftware.com/cgi-bin/ikon ... &topic=390">http://www.neosoftware.com/cgi-bin/ikonboard/topic.cgi?forum=3&topic=390



Updated plugin-page:



http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/neobook.html">http://hpwickern.bei.t-online.de/anmeld ... obook.html">http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/neobook.html



I upload a new demo-exe of the release demo to my plugin-page:



http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip">http://hpwickern.bei.t-online.de/anmeld ... SPDemo.zip">http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
Hans-Peter