Op Mon, 22 Jan 2007, schreef Felipe Monteiro de Carvalho:

> On 1/22/07, Daniël Mantione <[EMAIL PROTECTED]> wrote:
> > Of course, you can import a class like you did, and even automate it, I
> > don't see a problem with adding C++ mangling. But, you cannot use class
> > syntax, since classes are fundamentally incompatible with C++ classes.
> 
> Automating C++ mangling would already be great, but if one can´t use
> c++ methods inside classes, how will the name mangler know that the
> function is actually a method from a class with a given name?
> 
> And how would this be added? Extra keywords to be added to functions?
> Maybe 2 different keywords, one for cpp method name mangling and
> another for c function name mangling, so I would declare:
> 
> function User.Sum(Self: Pointer; a, b: cint): cint; cdecl; external
> 'cpplib.dll'; cpp_method_name_mandling;
> 
> On this solution we treat the C++ object as a pointer that is passed
> around, and can only be created and destroyed by imported functions.

It will have to be done like this: Treat the self pointer as some kind of 
handle. The handle is created by the constructor and destroyed by the 
destructor. Calling virtual methods is not possible, in fact OOP 
programming is not possible due to the lack of polymorphy; you will 
interface with the C++ library completely with procedural programming.

Daniël
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to