[fpc-pascal]Mapping Object Pascal Classes to C++ Classes

Olivier Coursiere olivier.coursiere at laposte.net
Thu Nov 14 02:00:29 CET 2002

Hi all,

>> Afaik you're one of the BeFPC people, right? 
>Yeah, except I'm on hiatus from that project. There are two French 
guys leading 
>up at the moment, and they are wrapping the API directly with a 
>approach to that I started with. I want to wrap the API in a VCL/LCL 
>using a flattened universal API. This will get picked up at some point 
in the 
>new year. The groundwork is there, but I have to make it more generic.

I am one of the french guys ;-)

>The other guys have written a class mapper of sorts. I haven't really 
>keeping up with them. 

In fact, the class mapper is not yet finished. 
Our tool is an automated C++ class flattener, but it is specifically 
for the C++ API of BeOS :

 - no C++ exception 
 - no template 
 - few multi-inheritance
 - support of hooks to answer to system events (optional and maybe a 
BeOS feature)

It should also work on other systems if your API respect the above 
(with some minor change i think).

We have a proof of concept tool that generate the C/C++ part of the 
glue code.
This tool is based on stubgen and is written in C.

Curently, i am writing a new tool (codegen) that will also generate the 
pascal part.

How it works :

codegen use a XML description of the header and a basic typmap file. 
It will generate pascal and C/C++ glue code. 
It use the "flat" way, but it also generate a pascal class to wrap C 
(each C++ classe will have a corresponding pascal one)

The XML description is generated with headertoxml. This tool use the 
stubgen parser in a shared object (stubgen.so). I pack stubgen in 
a shared object to write most of the code in pascal.

More informations (sources) at
in those directories :

 - codegen
 - headertoxml
 - stubgen
 - stubgen.so

>Supporting FPC would be cool too.

This is in my TODO's list too but i have no time yet because of the 
above project...

More information about the fpc-pascal mailing list