> Seems to work for me, updated the example: https://gist.github.com/2950789 > > Or am O missing something ?
Change your method to procedure TMyClass.SayHi; begin writeln('Hi World from '+IntToStr(ptruint(self))); end; And the test to write('From MyClass2 : '); MyClass2.SayHi; if not ExecMethod(MyClass2, 'SayHi') then writeln(STDERR, 'Could not find SayHi method on MyClass2 instance'); And you'll get something like: >From MyClass : Hi World from 482800 Hi World from 4199728 >From MyClass2 : Hi World from 482816 Hi World from 4199728 As Bern said you can't call an object method without passing the reference to the instance. In this case you are lucky because TMyClass.SayHi doesn't use any properties or class vars. Add a property to TMyClass and try to writeln that property and you will see it fails. What you are doing here is calling SayHi as if it where a class method. Ludo _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal