我想使用加载 DLL()来加载我自己在 Visual Studio 中构建的 DLL。有人成功完成过吗?
在哪里可以找到演示如何在 DLL 端执行此操作的示例源代码。
这是我想去的方向。 谢谢!
如果有一个示例 VS 解决方案/项目可供下载和编译,那就太好了。
也许您可以从技术支持中得到一些东西;可能有一个名为 ExtFunctionTests 的文件,它是一个 C++ 程序,包含一整套用于将数据类型传入和传出 DLL 的示例。
或者这可能会朝着正确的方向发展(这是 2009 年使用当时流行的任何版本的 visual studio 构建的。 这是重要的部分。 “声音”因为此 DLL 用于让 JMP 播放声音)
DLL中的JMP接口函数:
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;
}.DEF 文件
; JMPSound.def : Declares the module parameters for the DLL.
LIBRARY "JMPSound"
EXPORTS
; Explicit exports can go here
_JMP_Declarations
由于上面的 g_Declarations,用于初始化 DLL 的 JSL 很简单:
dll = loaddll("C:\Documents and Settings\L\Desktop\JMPSound.dll");
dll<<INIT></INIT>“初始化()”只是工作。 和“feed()”类似,传递数组...
data = leftchan || rightchan || col1:*alternate || col2:*alternate || col3:*alternate || col4:*alternate;
dll << feed( data, 0 );
(DLL 的目的是通过 feed 函数接受音频样本并播放它们……而 JMP 正在计算下一组样本。 线程内容特定于此 DLL,您不需要使用线程。)
请参阅 Mark 的 JMP 感知 DLL 链接。 我做了一个,很久以前。 需要明确的是,有两种类型:JMP 感知 DLL,以及所有其他类型。 JMP 感知 DLL 有一些额外的信息,使其更易于使用,并且可能没有不可用的入口点。 使用不能很好地映射到 JMP 数据类型的复杂结构和指针的入口点可能无法使用。
我会看看能不能找到它,我把它放在哪里都满是灰尘......
这是一个无意识使用“多媒体DLL中的PlaySound"信封中的音频笔记
@jschroedl
如果您执行“帮助 > 脚本索引”并搜索“DLL”,您应该会看到许多示例来帮助您入门:
