Risolto !!! Ormai non sapevo più a che santo rivolgermi, ma ce ne voluto per capirlo.
Il problema era dovuto al passaggio dei parametri, da così :
> function My_ValStringa(var cValore:PChar):Double;cdecl;export;
diventa così :
function My_ValStringa(cValore:PChar):Double;stdcall;
chiaramente anche la funzione da così :
> function My_ValStringa(var cValore:PChar):Double;cdecl;export;
> var
> nIndice : integer;
> lString : boolean;
> begin
> lString := false;
> for nIndice :=1 to Length(cValore) do
> begin
> if (NOT (cValore[nIndice] in ['0'..'9'])) then
> lString := true;
> end;
> if not lString then
> result := StrToFloat(cValore)
> else
> result := 0;
> end;
l'ho ottimizzata e diventa così :
function My_ValStringa(cValore:PChar):Double;stdcall;
begin
try
Result := StrToFloat(cValore);
except
on Exception : EConvertError do
Result := 0;
end;
end;
La dichiarazione da così :
> DECLARE EXTERNAL FUNCTION f_MyValStringa
> CString(255)
> RETURNS double precision
> entry_point 'My_ValStringa' module_name 'MyUdf.dll'
diventa così :
DECLARE EXTERNAL FUNCTION f_MyValStringa
CString(255)
RETURNS double precision by value
entry_point 'My_ValStringa' module_name 'MyUdf.dll'