diff options
| author | sergei <sergei@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-11-20 21:36:29 +0000 |
|---|---|---|
| committer | sergei <sergei@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-11-20 21:36:29 +0000 |
| commit | 17ec20e5a6c320bbbaf5991d9fdf6c38963db4a0 (patch) | |
| tree | d379218289e5b25674576891f3903a7fa3d70fba /packages/winunits-base | |
| parent | 8c6de339306a82345589804643bb99a894cad12c (diff) | |
| download | fpc-17ec20e5a6c320bbbaf5991d9fdf6c38963db4a0.tar.gz | |
+ comobj.pp, DispatchInvoke and DoDispCallByID: support Variant parameters passed by value, support Int64 and QWord arguments.
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16388 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/winunits-base')
| -rw-r--r-- | packages/winunits-base/src/comobj.pp | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/packages/winunits-base/src/comobj.pp b/packages/winunits-base/src/comobj.pp index d9a98ae87a..358f7abc38 100644 --- a/packages/winunits-base/src/comobj.pp +++ b/packages/winunits-base/src/comobj.pp @@ -1085,7 +1085,7 @@ HKCR for i:=0 to CallDesc^.ArgCount-1 do begin {$ifdef DEBUG_COMDISPATCH} - writeln('DispatchInvoke: Params = ',hexstr(PtrInt(Params),SizeOf(Pointer)*2)); + writeln('DispatchInvoke: Params = ',hexstr(Params)); {$endif DEBUG_COMDISPATCH} { get plain type } CurrType:=CallDesc^.ArgTypes[i] and $3f; @@ -1138,7 +1138,7 @@ HKCR end; end end - else + else { by-value argument } case CurrType of varStrArg: begin @@ -1156,18 +1156,24 @@ HKCR varVariant: begin {$ifdef DEBUG_COMDISPATCH} - writeln('Unimplemented variant dispatch'); + writeln('By-value Variant, making a copy'); {$endif DEBUG_COMDISPATCH} + { Codegen always passes a pointer to variant, + *unlike* Delphi which pushes the entire TVarData } + Arguments[i]:=PVarData(PPointer(Params)^)^; + Inc(PPointer(Params)); end; varCurrency, varDouble, - VarDate: + varInt64, + varQWord, + varDate: begin {$ifdef DEBUG_COMDISPATCH} - writeln('Got 8 byte float argument'); + writeln('Got 8 byte argument'); {$endif DEBUG_COMDISPATCH} Arguments[i].VType:=CurrType; - move(PPointer(Params)^,Arguments[i].VDouble,sizeof(Double)); + Arguments[i].VDouble:=PDouble(Params)^; inc(PDouble(Params)); end; else @@ -1334,7 +1340,7 @@ HKCR flags : WORD; invokeresult : HRESULT; preallocateddata : array[0..15] of TVarData; - Arguments : ^TVarData; + Arguments : PVarData; CurrType, i : byte; dispidNamed: dispid; begin @@ -1349,7 +1355,7 @@ HKCR for i:=0 to desc^.CallDesc.ArgCount-1 do begin {$ifdef DEBUG_DISPATCH} - writeln('DoDispCallByID: Params = ',hexstr(PtrInt(Params),SizeOf(Pointer)*2)); + writeln('DoDispCallByID: Params = ',hexstr(Params)); {$endif DEBUG_DISPATCH} { get plain type } CurrType:=desc^.CallDesc.ArgTypes[i] and $3f; @@ -1367,24 +1373,27 @@ HKCR else begin {$ifdef DEBUG_DISPATCH} - writeln('DispatchInvoke: Got ref argument with type = ',CurrType); + writeln('DispatchInvoke: Got value argument with type = ',CurrType); {$endif DEBUG_DISPATCH} case CurrType of varVariant: begin - Arguments[i].VType:=CurrType; - move(PVarData(Params)^,Arguments[i],sizeof(TVarData)); + { Codegen always passes a pointer to variant, + *unlike* Delphi which pushes the entire TVarData } + Arguments[i]:=PVarData(PPointer(Params)^)^; inc(PVarData(Params)); end; varCurrency, varDouble, - VarDate: + varInt64, + varQWord, + varDate: begin {$ifdef DEBUG_DISPATCH} - writeln('DispatchInvoke: Got 8 byte float argument'); + writeln('DispatchInvoke: Got 8 byte argument'); {$endif DEBUG_DISPATCH} Arguments[i].VType:=CurrType; - move(PPointer(Params)^,Arguments[i].VDouble,sizeof(Double)); + Arguments[i].VDouble:=PDouble(Params)^; inc(PDouble(Params)); end; else |
