Re: dll woes
- Posted by ghaberek (admin) Mar 26, 2015
- 1685 views
Can someone either tell me what I am doing wrong here, or confirm that there is a bug?
I believe I can confirm this is a bug.
If you change the call to dlopen() in be_machine.c (line 2114) to use RTLD_LOCAL instead of RTLD_GLOBAL, the issue goes away. This leads me to believe that the cleanup code in your compiled Euphoria library (put there by the Translator, not you) is freeing something in global memory before all of the references have dropped to zero - hence the "double free" message you're seeing. At least, that's what I've gathered from a cursory Googling of the message and the documentation provided for dlopen().
Is it safe to use RTLD_LOCAL instead of RTLD_GLOBAL? Probably. But I'd say the safest approach is to track down the offending code in the translated library or only use RTLD_LOCAL for translated Euphoria libraries, and use RTLD_GLOBAL for any "foreign" (non-Euphoria) or "native" (C/C++) library. More testing is needed to confirm.
-Greg