[fpc-devel] First cppclass test

Florian Klaempfl florian at freepascal.org
Thu Nov 12 22:49:28 CET 2009


Sven Barth schrieb:
>>> If so, how do you
>>> suggest to write those tests, especially as they (currently) rely on a
>>> external library...
>>
>> Libraries or object files? FPC does similiar testing for C linking: the
>> C sources are checked in into
>> http://svn.freepascal.org/svn/fpc/trunk/tests/test/cg/obj/
>> Compiled object files lay in the appropriate sub dir of this dir.
>>
>> Testing C++ class linking should be done similiar imo.
>>
> 
> In theory that is possible, but I found a practical problem: C++ code
> requires libstdc++ or at least libsupc++ which implements the "new" and
> "delete" operators. And to make things worse: this library isn't
> available in the Windows release of the compiler... (not a real problem
> for me as I'm working on Linux...)

A lot name mangling etc. can be tested without new/delete: just make the
classes static. Further, fpc must be able to create c++ classes on the
heap anyways.

> 
> While I could be able to simulate the needed functionality of the
> library through Pascal units with correct named procedures/functions, I
> don't think that this is the way to go. A better solution (at least for
> compiler tests) would be to just compile but not link those test units.
> Does the test framework support such an option?

Yes, but this is imo a bad idea, better get it running with some hacking.



More information about the fpc-devel mailing list