For the latest version of JMP Help, visit JMP.com/help.

dll_obj = Load DLL("path" <, AutoDeclare(Boolean | Quiet | Verbose) |Quiet | Verbose > )
Load DLL() loads the DLL in the specified path. Use the AutoDeclare(Quiet) argument to suppress log window messaging.
Use the Declare Function message to declare a function that is defined in the DLL.After you declare the function, you can call it.
dll_obj <<Declare Function("name", Convention(named_argument), Alias("string"), Arg(type, "string"), Returns(type), other_named_arguments)
The Alias defines an alternate name that you can use in JSL. For example, if you declared Alias("MsgBox") for a function that is named "Message Box" in the DLL, then you would call it as follows:
result = dll_obj <<MsgBox(...)
The named arguments for Convention are as follows:
STDCALL or PASCAL
The type argument for both Arg and Returns can be one of the following:
See the JSL Messages chapter in the for the Declare Function message arguments.
Finally, use the UnLoadDLL message to unload the DLL:
dll_obj << UnLoadDLL
If( Host is( "Windows" ),
	If(
		Host is( "Bits64" ),
		// Load the 64-bit DLL.
			dll_obj = Load DLL( "c:\Windows\System32\user32.dll" ),
		// Load the 32-bit DLL.
			dll_obj = Load DLL( "c:\Windows\SysWOW64\user32.dll" ),
		// If neither DLL is found, stop execution.
			Throw
		);
	dll_obj <<DeclareFunction(
		"MessageBoxW",
		Convention( STDCALL ),
		Alias( "MsgBox" ),
		Arg( IntPtr, "hWnd" ),
		Arg( UnicodeString, "message" ),
		Arg( UnicodeString, "caption" ),
		Arg( UInt32, "uType" ),
		Returns( Int32 )
	);
	result = dll_obj << MsgBox(
		0,
		"Here is a message from JMP.",
		"Call DLL",
		321
	);
	Show( result );
);
dll_obj << UnLoadDLL
In the following example, the DLL contains a function named netPresentValue, which takes four parameters. Declare Function() defines these parameters and the data type that the function returns so that JMP can successfully call the function.
If( HostIs( Bits64 ),
	xftdll = Load Dll( "c:\ExtFunctionTests\ExtFunctionTests_x64.dll" ),
	xftdll = Load Dll( "c:\ExtFunctionTests\ExtFunctionTests.dll" )
);
Show( xftdll );
 
xftdll << Declare Function(
	"netPresentValue",
	Convention( CDECL ),
	Alias( "npv" ), // use this name to call the function in JMP
	Arg( Double, "discount rate" ),
	Arg( Double, "cash flows per period" ),
	Arg( Int32, "number of cash flows" ),
	Arg( Double, Array, "array of cash flow values" ),
	Returns( Double )
);
 
result = xftdll << npv( 0.10, 1, 10, [ 100, 100, 100, 100, 100,
	100, 100, 100, 100, 100 ]
);
 
Show( result );
result = 675.902381627515;
dll_obj << Show Functions;
If you are writing your own DLL, you can create functions in it using JSL. The Get Declaration JSL message sends any JSL functions in your DLL to the log:
dll_obj << Get Declaration JSL;

Help created on 3/19/2020