Re: Project Leviathan - wxEuphoria 3.1.0 alpha1
- Posted by ghaberek (admin) Jan 16, 2017
- 1776 views
No (as per that thread I mentioned I expect there will be times when wxdll:free() must be invoked instead of free(), and that sort of thing)
[EDIT] Actually, with the new or old, if you have sequence s = wxdll:somefunc(), then some time later the refcount of s drops to zero, I predict it will invoke the wrong free().
I've read through that thread a few times now, and I've poured over the source code for Phix, especially pHeap.e and pcfunc.e.
But what I'm still trying to understand is how there is a "wrong" free() and a "right" free(). Don't the process and its loaded libraries share a common heap?
So if I call HeapAlloc() in the library and then later call HeapFree() in the interpreter, that would still be the "right" free(), correct?
Side note: For those who aren't aware, on Windows the functions HeapAlloc(), et al. are aliased as malloc(), etc. using macros:
#ifdef WXEUMSW #define malloc(n) HeapAlloc((void *)default_heap, 0, n) #define free(p) HeapFree((void *)default_heap, 0, p) #define realloc(p, n) HeapReAlloc((void *)default_heap, 0, p, n) #endif
Did it (the original wxEuphoria) work with Phix?
No
From what I see, there's no support in Phix for Euphoria-built shared libraries, which is what wxEuphoria is pretending to be. Please correct me if I'm wrong there.
Can we make this work?
Not if the abstraction bleeds internal (4.1-specific) implementation details. (see that thread for why I am saying that)
It seems to me that there are a few options to make wxEuphoria work with Phix:
- Get Phix to "speak Euphoria" to a shared library. Given that its internal representation of objects is altogether different, I doubt that's likely to occur.
- Get wxEuphoria to "speak plain C" with just const char*, int, double, etc. This requires more effort in the Euphoria binding code.
-Greg