RE : [fpc-pascal] Dynamically Execute method

2012-06-19 Thread Ludo Brands
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

Re: [fpc-pascal] Dynamically Execute method

2012-06-19 Thread Mattias Gaertner
On Tue, 19 Jun 2012 00:22:29 +0300 ik ido...@gmail.com wrote: Hi, I'm playing a bit with the notion of execute a method dynamically on demand. I'ved created the following PoC: https://gist.github.com/2950789 It works, but for some strange reason, I find myself feeling that I'm missing

RE : RE : [fpc-pascal] Dynamically Execute method

2012-06-19 Thread Ludo Brands
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

[fpc-pascal] Automatically exporting C++ API using SWIG??

2012-06-19 Thread Reinier Olislagers
The recent thread about using C headers made me think about using C++ projects. Found that the SWIG tool converts C/C++ .h files into glue code and bindings for e.g. Python, Modula 3... but not Delphi/Object Pascal. It seems you get an object-oriented binding. Did see this post from 2010 about

Re: RE : RE : [fpc-pascal] Dynamically Execute method

2012-06-19 Thread ik
On Tue, Jun 19, 2012 at 10:38 AM, Ludo Brands ludo.bra...@free.fr wrote: 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

[fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread ik
Hello, Is there a way to tell in run-time that a specific function/procedure should belong to a class ? For example, let's say I have the following class: Type TTest = class procedure Foo; end; And I have also: procedure Bar; ... end; Is there a way to make at some point of my code

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread michael . vancanneyt
On Tue, 19 Jun 2012, ik wrote: Hello, Is there a way to tell in run-time that a specific function/procedure should belong to a class ? For example, let's say I have the following class: Type TTest = class procedure Foo; end; And I have also: procedure Bar; ... end; Is there a way

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread Jonas Maebe
michael.vancanneyt wrote on Tue, 19 Jun 2012: As far as I know there is no language structure for this, unless the objective C classes support offers this. You can indeed do that in Objective-C/Pascal, but a) that's not via a language construct, but by directly interacting with the

[fpc-pascal] DOM and namespaces with prefix

2012-06-19 Thread Torsten Bonde Christiansen
Hi all. I am working on implementing a lite export routine from our program to the DDI XML format: http://www.ddialliance.org/Specification/DDI-Lifecycle/3.1/XMLSchema/ A convinient way of working with the DDI format is to prefix elements using common set of prefix'es, but having spent most

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread Mattias Gaertner
ik ido...@gmail.com hat am 19. Juni 2012 um 14:22 geschrieben: Hello, Is there a way to tell in run-time that a specific function/procedure should belong to a class ? For example, let's say I have the following class: Type TTest = class procedure Foo; end; And I

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread ik
On Tue, Jun 19, 2012 at 4:13 PM, Mattias Gaertner nc-gaert...@netcologne.de wrote: ** ik ido...@gmail.com hat am 19. Juni 2012 um 14:22 geschrieben: Hello, Is there a way to tell in run-time that a specific function/procedure should belong to a class ? For example, let's say I have

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread JC Chu
Depending on what you’re actually trying to do, you may consider implementing your own invokable variant type. I found a tutorial at http://alex.ciobanu.org/?p=152. Basically, instances will be wrapped in a TVarData-compatible record, and your custom TInvokeableVariantType-derived class will

[fpc-pascal] Creating video files

2012-06-19 Thread Krzysztof
Hi, I would like to write video (created from series of bitmaps) to some popular video formats like avi, flv. Is this possible? Has FPC bindings for video librarys? I googled that WinFF (http://winff.org/html_new/) is written in FPC and Lazarus, so I supose that some bindings exists but can't

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread LacaK
Class helpers would not help ? http://wiki.freepascal.org/Helper_types -Laco. Hello, Is there a way to tell in run-time that a specific function/procedure should belong to a class ? For example, let's say I have the following class: Type