[fpc-pascal] About FPC calling register like Delphi
Carlo Kok
ck at carlo-kok.com
Fri Jan 26 14:23:14 CET 2007
Alexandre Leclerc wrote:
> 2007/1/26, Carlo Kok <ck at carlo-kok.com>:
>> Michael Van Canneyt wrote:
>> >
>> > On Thu, 25 Jan 2007, Alexandre Leclerc wrote:
>> >
>> >> 2007/1/25, Felipe Monteiro de Carvalho
>> <felipemonteiro.carvalho at gmail.com>:
>> >>> On 1/25/07, Alexandre Leclerc <alexandre.leclerc at gmail.com> wrote:
>> >>>> Yes, I understand that, but I *need* a scripting engine which is
>> based
>> >>>> on Pascal. And ROPS is the only one I found that answered my
>> >>>> requirements. Also, it's integrated and it's "free", and very fast.
>> >>>>
>> >>>> If there was another way, I would use it. But since, I must rely
>> on a
>> >>>> stable FPC internal to make it work.
>> >>> Does this script support other calling conventions?
>> >>>
>> >>> You could try using stdcall instead of register. It´s much simpler,
>> >>> and as stable as it can get.
>> >>>
>> >>> I remember writing a simple script engine myself, and then I
>> choose to
>> >>> support mostly stdcall.
>> >> ROPS (RemObjects Pascal Script remobjects.com) is 100% pascal code
>> >
>> > Not 100%, there is 1 routine which is assembler, it's the routine
>> > that sets up the stack when making a call to an imported function.
>> >
>> >> that you simply use in your own code. The engine compiles in your
>> >> application. It then work with the application stack, etc. to execute
>> >> native pascal functions and script functions. Quite a nice script
>> >> engine.
>> >
>> > I use it since ages, even when it was not owned by remobjects.
>>
>> You are right about that. There is a routine that does that, but all it
>> does is copy the prepared data onto the stack (And copy back the
>> result). Now, there are a few problems with PS related to FPC:
>>
>> * FPC has changed default calling convention once (or twice?)
>> * The way "register" works on FPC is slightly different from delphi, in
>> delphi special types like interfaces, strings and variant results are
>> passed as var parameters, it seems the easiest fix would be for me to
>> change PascalScript to process results differently for FreePascal.
>>
>> How does FPC pass a string/variant/interface result actually? Returned
>> in AEX?
>>
>>
>> Once I know this, I should be able to add an FPCFIX define for this. (So
>> it can be easily undone when FPC supports the same "Register" mode as
>> Delphi does)
>
> Carlo,
>
> I was planning to build a small application to serve as a regression
> test (by testing some features of PS in FPC) in order to find quickly
> any problems. I was planning to do this in couple weeks. If this
> interest you, I can send you the code after so that it will become
> easier for you to test any feature that is broken in FPC.
>
Would be great.
More information about the fpc-pascal
mailing list