[Y-devel] C API?

Jerome Laheurte jerome at gandalf.fraca7.homeunix.net
Sun Feb 22 06:53:10 GMT 2004


On Sat, 21 Feb 2004, Richard Hills wrote:

> On Sat, 2004-02-21 at 21:37, Mark Thomas wrote:

>         This is something I'd be happy to do. I was wondering, is it possible
> for a C interface to use the underlying C++ interface, in order to
> reduce code duplication? As far as I understand it, the C interface for
> GTK is the base for several other language wrappers, so is it possible
> to do the same thing in reverse? Thanks,

This is possible. Just cast any instance pointer to void* and wrap
methods through functions declared 'extern "C"' to prevent name
mangling. Build with a C++ compiler.

Of course, any self-respecting C/C++ programmer who looks at your code
will lose 1d100 SAN and curse you to the seventh generation, but it's
possible :)

-- 
Jérôme Laheurte <fraca7 at free.fr>
Once, adv.:
        Enough.
                -- Ambrose Bierce, "The Devil's Dictionary"



More information about the Y-devel mailing list









2026 © www.Y-Windows.Org - All Rights Reserved