[Prev][Next][Index][Thread]

Re: Using old C++ libraries with Dylan



On Friday, September 14, 2001, at 05:07  am, Mark Jordan wrote:

> I'm on a PC, probably going to be using Fun-Dev.
> Can you elaborate on those differences?

Gwydion compiles Dylan to C which it then compiles to machine code. 
There is support for including C code in Dylan code in various 
interesting (but limited) ways, and you can look at the C code to pull 
names out or seen how things work. You can also link Dylan and C code 
into the same library, and there's a (slightly buggy) C Header parser to 
generate Dylan interfaces to C code.

Fun-Dev is much nicer to use and has an infinitely better debugger. More 
to the point, it has a fully functional version of the C-FFI (Gwydion's 
is weaker but still usable), which means it is very good at talking to 
DLLs, making Dylan callbacks, and mapping C types into Dylan and vice 
versa.

>> Or you can wrap the public API methods in try/catch blocks and call
>> Dylan in the catch() section.
>
> This sounds like quite a good idea. If I call the dylan
> function in the C++ catch handler, it might be able to
> throw a native dylan exception without any problems. I
> could also "poke" a memory value on the stack of the
> wrapper and check it then throw. I'd have to experiment
> these ideas. Looks like some further hacking might be
> in order ;-)

Can anyone think of any problems with this approach?

Let us know how you get on. :-)

- Rob.