[fpc-pascal]Virtual methods in asm block

Peter Vreman peter at freepascal.org
Mon May 19 09:02:25 CEST 2003


At 04:28 18-5-2003, you wrote:
>Hi everyone -
>
>is there any way to call a virtual method of a class from within an
>assembler block/function/method?
>
>I checked out FPC's generated-assembler source but it uses a
>constant-offset, e.g.:
>
>movl       (%esi),%edi
>call       *92(%edi)
>
>the "*92" is the offset for that particular method in the classes' VMT, but
>is there any way I can obtain this number myself? (is it a named constant
>anywhere?? I only need it at compile-time) Calling the method by name works
>for that class but doesn't recognise "override" methods in descendents....
>
>Thanks in advance...

There is no way to retrieve this information, you need to calculate the 
offset yourself. Also note that the calling of methods will be little 
different between 1.1 and 1.0.x and it is therefor not recommended to call 
methods from assembler code. You can make a pascal wrapper arround the method




Peter





More information about the fpc-pascal mailing list