Dňa 20.10.2016 o 17:48 José Mejuto napísal(a):
El 20/10/2016 a las 15:20, LacaK escribió:

There is:
          if bParamByRef then
            case FD^.lprgelemdescParam[k].paramdesc.wParamFlags and
(PARAMFLAG_FIN or PARAMFLAG_FOUT) of
            PARAMFLAG_FIN or PARAMFLAG_FOUT:sPar:='var ';
            PARAMFLAG_FOUT:sPar:='out ';
            PARAMFLAG_FIN:sPar:='var '; //constref in safecall? TBD
            end;
In my case bParamByRef = True, but wParamFlags=0 so no "var" nor "out"
is added ...
(as I do no known about type libraries I fear, that any modification
which fixes my case can cause problems in another cases)
So I have posted bug report:
http://bugs.freepascal.org/view.php?id=30764 may be somebody experienced
can fix it ...

Hello,

If wParaFlags is 0 then no "var" or "out" must be added (unless bug in filling wParamFlags with value)

I do not know, but I know, that:

- when I import this type library in Delphi gives in this function "var" (not only in case of WideString but also in case of integer for example) ... so I guess that there must be way how to handle it

- when I manually add in FPC "var" it works as expected (without "var" it gives runtime error about incompatible types)

- in documentation of OCX is function parameter described as "BSTR* Value" for "var WideString" resp. "long* Value" for "var integer"

- in typelib.pas is on line 631 vt=VT_PTR and sl='PWideString' ('P' is deleted on line 635) wParamFlags=0
When I add "else" part:
case FD^.lprgelemdescParam[k].paramdesc.wParamFlags and (PARAMFLAG_FIN or PARAMFLAG_FOUT) of
              PARAMFLAG_FIN or PARAMFLAG_FOUT:sPar:='var ';
              PARAMFLAG_FOUT:sPar:='out ';
              PARAMFLAG_FIN:sPar:='var '; //constref in safecall? TBD
/*added*/  else sPar:='var ';
            end;
it works for me.
But I have no idea if it can negative impact other cases ?

Thanks
-Laco.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to