Is there a default parameter with DLL calling?
> (setq mytest(get-string(hpwMimeEncodeString "")))
""
> (setq mytest(get-string(hpwMimeEncodeString "€")))
"gA=="
> (setq mytest(get-string(hpwMimeEncodeString nil)))
"gA=="
When I use nil or undefined symbol the DLL get a '€' (ASCII 128).
Is this a default or where does it come from.
No, there is no default parameter, it all depends how your function 'hpwMimeEncodeString' is written and how much parameters you pass, if you don't pass the exact numbers and types the function is written for, the result is not defined. On Windows it is also necessary to compile for the correct calling conventions.
Lutz
The parameter is PChar and it is not a real problem.
I pass acidently a nil to it and wondered about the return-value.
When passing nil to the parameter, I thought to get an empty string, but it was the '€'.
Maybe something which comes from delphi by default.
Here is an explanation if you are interested in newLISP internals:
In case that you pass a parameter which is not an integer, float or string newLISP passes the ardress of the lisp cell. I you case the receiving imported routines took this address as a string pointer and the value the cell address was pointing to, happens to be "€" which is the lowest byte of the type word in the lisp cell.
You can simulate this by doing a:
(get-string nil) => "€"
or
(char (get-string nil) ) => 128
This is the type byte of the lisp cell nil
Lutz
Thanks for the explanation.
So we have to check the passed parameter first on nil.