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.
DLL calling parameter default?
DLL calling parameter default?
Hans-Peter
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
Lutz
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
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