Re: The Euphoria IDE Project

new topic     » goto parent     » topic index » view thread      » older message » newer message
petelomax said...

I had a look this weekend at getting wxEuphoria to run on Phix, and I made some notes on the matter. My apologies if this isn't helpful.

It seems I would need to suck alot of complexity out of libwxeu.dll (C++) into wxeud.e, specifically defaults, reference counting, and delete routines. In short, libwxeu.dll/so should contain absolutely no knowledge whatsoever of underlying data structures, and hence be compatible with both OpenEu and Phix.

Routines must be called/defined with atoms/pointers (C_INT etc), rather than E_SEQUENCE/E_OBJECT/E_ATOM/E_INTEGER. The logic for defaulted parameters would need to be moved out of wxeu.cpp, so for example (simplified/untested) instead of:

First, I would like to emphasize that if you have used C_INT, C_LONG (or their unsigned counterparts) for a pointer, you're doing it wrong, as these are not portable. Euphoria 4.1 will also run on 64-bit operating systems, so this is important.

Previous versions of wxEuphoria required that the manipulation of pointers, peeking and poking be done on the euphoria side. Not surprisingly, it's a lot easier to work with C++ data in C++ than in euphoria. Also, moving the creation macros into euphoria code would mean writing a lot more code.

petelomax said...

Also, I don't really understand why it needs wxDeRefDS() etc; I can only assume that because it is using E_SEQUENCE; params gets incref'd and ends up in libwxeu.dll with a ref count >=2? Unless you do on-the-fly creation in wxeud.e then the actual deallocation/calling of any delete routine etc will occur not in libwxeu.dll but in exeud.e when "params" gets decref'd or when some callee variable drops out of scope.

wxEuphoria follows "normal" euphoria reference counting semantics, which makes using it very simple from a euphoria point of view, and is necessary to take E_SEQUENCE, etc, parameters and prevent memory leaks.

petelomax said...

Anyway, that's where I got, like I said don't know if that is of any interest or use.

The alternative would be to rewrite wxeu.cpp pretty much from scratch, but embed the knowledge of the underlying Phix data structures rather than those of OpenEu.

Yes, it sounds like that's what would have to happen. After a lot of experimenting, I think that the way I've got wxEuphoria working is the easiest way to go about wrapping a C++ library.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu