Jo Dillon wrote:
As I've said before on this list, I'm porting an Object Pascal application to MacOS using a GPC cross-compiler. I've got a sort of minimal runtime system on the Mac, which enables my application to run - however, it explodes on (as far as I can see) the first call to a virtual function. This may be because my implementation of GPC_New/_p_new just looks like this:
void * _p_new(int size) { return malloc(size); }
Whereas the proper one appears to do thinks like mark the object.
It is not _p_new() that does this job, but the compiler generates code to initialise the object after _p_new() has finished.
My question is, is it the case that I need to fix up the vtbl in _p_new, and if so where do I do it? Where does marking fit into it?
You can examine the assembler code whether the initialisation is done: There must be an assignment of the address of vmt_Fooobj (with `FooObj' being the name of your object type) to the first location in the new variable pointed to.
From the Pascal program you can examine this address with the `TypeOf' function or assign a value to it with `SetType'.
Hope this helps, Peter -- Peter Gerwinski, Essen, Germany, http://home.pages.de/~Peter.Gerwinski/ Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-19990118 PGP key on request - 6C 94 45 BE 28 A4 96 - 0E CC E9 12 47 25 82 75 *** Vote against SPAM! ********* http://www.politik-digital.de/spam/ ***