[fpc-pascal] importtl tool
joshyfun at gmail.com
Thu Oct 20 17:48:33 CEST 2016
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
> 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 ...
If wParaFlags is 0 then no "var" or "out" must be added (unless bug in
filling wParamFlags with value) as it should be something like
"constref" as "const" is not valid because it will try to perform a
copy. Maybe "var" could be used :-? but it could be a problem if the
called function changes the param expecting it to be discarded on return.
For native types like int and so on a const will work, but for
interfaces, widestring, ... inclusion of var can crash some functions
and not adding it could crash another ones.
More information about the fpc-pascal