Visual Studio에 내장된 자체 DLL과 함께 Load DLL()을 사용하고 싶습니다. 누구든지 성공적으로 수행 했습니까?
DLL 측에서 이 작업을 수행하는 방법을 보여주는 샘플 소스 코드는 어디에서 찾을 수 있습니까?
이것이 내가 가고 싶은 방향이다. 감사해요!
다운로드하고 컴파일할 샘플 VS 솔루션/프로젝트가 있으면 좋을 것입니다.
기술 지원을 통해 뭔가를 얻을 수도 있습니다. DLL 안팎으로 데이터 유형을 전달하기 위한 완전한 예제 세트가 포함된 C++ 프로그램인 ExtFunctionTests라는 파일이 있을 수 있습니다.
아니면 올바른 방향으로 나아갈 수도 있습니다. (이것은 당시 인기 있었던 Visual Studio 버전이 무엇이든 2009년에 구축되었습니다. 중요한 섹션은 다음과 같습니다. "사운드"는 이 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
DLL을 초기화하는 JSL은 위의 g_Declarations로 인해 간단합니다.
dll = loaddll("C:\Documents and Settings\L\Desktop\JMPSound.dll");
dll<<INIT></INIT>"init()" just works. And "feed()" is similar, passing arrays...
<CODE class=" language-jsl"> 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.)
JMP 인식 DLL에 대한 Mark의 링크를 참조하세요. 나는 오래 전에 하나를 만들었습니다. 명확히 말하면 JMP 인식 DLL과 나머지 두 가지 종류가 있습니다. JMP 인식 DLL에는 사용을 좀 더 쉽게 해주는 몇 가지 추가 정보가 있으며 아마도 사용할 수 없는 진입점이 없을 것입니다. JMP 데이터 유형에 잘 매핑되지 않는 복잡한 구조와 포인터를 사용하는 진입점은 아마도 사용할 수 없을 것입니다.
혹시 찾을 수 있는지 찾아봐야겠습니다. 제가 놔둔 곳마다 꽤 먼지가 쌓여 있습니다...
다음은 봉투에 있는 "멀티미디어 DLL의 PlaySound" 오디오 노트를 인식하지 못한 채 사용하는 예입니다.
@jschroedl
DLL에 대한 JMP 도움말에도 다음 항목이 있습니다.
'도움말 > 스크립팅 색인'을 실행하고 'DLL'을 검색하면 시작하는 데 도움이 되는 여러 가지 예가 표시됩니다.
