newLISP Fan Club

Forum => newLISP in the real world => Topic started by: ryuo on June 06, 2014, 03:01:15 AM

Title: newLISP and windows DLLs
Post by: ryuo on June 06, 2014, 03:01:15 AM
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



(import "libnewt.dll" "newtGetScreenSize" "void" "void*" "void*")
(exit 0)
Title: Re: newLISP and windows DLLs
Post by: Lutz on June 06, 2014, 06:59:53 AM
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?
Title: Re: newLISP and windows DLLs
Post by: ryuo on June 06, 2014, 11:28:47 AM
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.