jsoftware / jsource

J engine source mirror
Other
645 stars 91 forks source link

J9 doesn't convert arguments before cd call #183

Open jip opened 4 months ago

jip commented 4 months ago

https://code.jsoftware.com/wiki/Guides/DLLs/Calling_DLLs says: "Arguments are converted as required to conform with their declaration type.". It was definitely true for j807/j64/linux, but not for j9.6.0-beta1/j64/linux.

Details are in jsoftware/math_lapack2@6ab70f046f9f569f4ef64366dd1dc15a90d9c735 which fixes a bug just catched. In short, if external DLL procedure expects an argument as array of datatype integer (e.g. (,2)), but an array of type float (e.g. (,2.0)) was sent, then J807 converts argument and cd calls procedure successively, but J9.6 throws "domain error in cd, executing dyad 15!:0". (cder '') returns error 6 x ("parameter x type doesn't match declaration").