Maybe you can get something from tech support; there might be a file called ExtFunctionTests that is a C++ program with a complete set of examples for passing data types in and out of a DLL.
Or maybe this will steer in the right direction (this was built in 2009 with whatever version of visual studio was popular at the time. Here are the important sections. "sound" because this DLL was used to let JMP play sound)
The JMP interface functions in the DLL:
EXPORTFUNC int __cdecl init( int nCols, int channelMask, int samplesPerSecond, int nRows )
{
if ( theApp.mSoundThread == NULL )
{
theApp.mSoundThread = (SoundThread*)AfxBeginThread( RUNTIME_CLASS(SoundThread), 0, 0, CREATE_SUSPENDED, 0 );
theApp.mSoundThread->init( nCols, channelMask, samplesPerSecond, nRows );
theApp.mSoundThread->ResumeThread();
return 1;
}
return 0;
}
EXPORTFUNC double __cdecl feed( double * matrix, int elements )
{
return theApp.mSoundThread->feed( matrix, elements );
}
LPWSTR g_Declarations = L"\
DeclareFunction(\"init\", Convention( CDECL ), \n\
Arg( Int32, \"nCols\" ), Arg( Int32, \"channelMask\" ), Arg( Int32, \"samplesPerSecond\" ), Arg( Int32, \"nRows\" ), Returns( Int32 ) ) << \n\
DeclareFunction(\"feed\", Convention( CDECL ),\n\
Arg(Double, Array, \"array of nCols channels X nRows samples, -1..+1 \"), Arg(Int32), Returns(Double) );\n\
";
LPCWSTR __stdcall _JMP_Declarations()
{
return g_Declarations;
}
The .DEF file
; JMPSound.def : Declares the module parameters for the DLL.
LIBRARY "JMPSound"
EXPORTS
; Explicit exports can go here
_JMP_Declarations
The JSL to init the DLL is simple because of the g_Declarations above:
dll = loaddll("C:\Documents and Settings\L\Desktop\JMPSound.dll");
dll<<init(6,1+2+4+8+16+32,48000,3*fullStroke);
"init()" just works. And "feed()" is similar, passing arrays...
data = leftchan || rightchan || col1:*alternate || col2:*alternate || col3:*alternate || col4:*alternate;
dll << feed( data, 0 );
(The purpose of the DLL was to accept audio samples through the feed function and play them...while JMP was computing the next set of samples. The threading stuff was specific to this DLL, you don't need to use threads.)
Craige