newLISP and windows DLLs

Started by ryuo, June 06, 2014, 03:01:15 AM

Previous topic - Next topic

ryuo

I have tried to get newLISP to load a libnewt.dll, but the interpreter has issues upon exit. It seems to happen when the DLL is unloaded. The entire DLL was compiled by GCC 4.8.1 from the mingw32 build system. Any ideas?



The error is like so:

This application has requested the Runtime to terminate it in an unusual way.

Please contact the application's support team for more information.



The import code is below. As for the DLL, it can be found here: https://github.com/ryuo/newlisp-newt/raw/master/newt-0.52.17/libnewt.dll">https://github.com/ryuo/newlisp-newt/ra ... ibnewt.dll">https://github.com/ryuo/newlisp-newt/raw/master/newt-0.52.17/libnewt.dll



(import "libnewt.dll" "newtGetScreenSize" "void" "void*" "void*")
(exit 0)

Lutz

#1
Have not seen this with other DLLs. May be you have to import and call some special clean-up functions for that library? It may allocate resources which have to be released explicetely?

ryuo

#2
I didn't think this would be an issue as C has very limited mechanisms for automated functions compared to C++, but I found a solution. I checked the DLL's dependency list, and noted that DLLs without libgcc seemed to work just fine. I tried linking with libgcc statically and newLISP no longer has any issues upon exit. Thanks.