call c++ function with matrix inputHi,
I'm trying to call my c++ functions in JSL. And I realize that I need to use the functions: "Load DLL()" and "Declare Function()". It seems to me that "Declare Function()" can only allow me to specify variables that are DOUBLE, INT, STRING? I also see the options like "Struct" and "ObjPtr", but I'm not sure how to use them.
If my C++ functions have matrix input and output, would I be able to import them into jmp?
P.S. the following code works for a function that has 'double' type of input.
If( Host is( "Windows" ),
dll =
Load DLL(
If(
File Exists(
"MYPATH/MathLibrary.dll"
),
"MYPATH/MathLibrary.dll",
Throw()
)
);
dll <<
DeclareFunction(
"TimesTwo",
Convention( STDCALL ),
Alias( "test_x2" ),
Arg( Double, "x" ),
Returns( Double )
);
result = dll << TimesTwo(8.8);
Show( result );
dll << Show Functions;
);
AnalyticsOtherScriptingRe: call c++ function with matrix inputHi Meichen,
Currently JSL's .DLL functions support matrices of doubles, but of no other type. I noticed this limitation when working on an addin to help with TDM files. You will need to write your own .dll as a go-between to bridge this gap. I am working on this very thing, but am still working on learning C thoroughly enough to accomplish this. Please add this request to the internal wish list--the more requests development receives to extend JSL's current functionality in this regard, the more likely the issue will be addressed in a future release.
Cheers,
Brady
Re: call c++ function with matrix inputThank you, @brady_brady ! I will add this request.
Would there be examples on how functions support matrices of doubles are imported in JSL? I had a hard time finding the instructions.
Re: call c++ function with matrix inputI don't currently have an example of this. As you mention, unfortunately this feature is not currently well documented. When it was first introduced, I don't think that many people were doing this kind of work... but now, there is a real need for it.