|
Boost : |
From: Elaine Wong (wongpl0503_at_[hidden])
Date: 2007-10-01 07:16:24
I am using boost.python to wrap C++ function which includes
directmusic libraries to simply play the midi, but lots of linkage
errors "error LNK2001: unresolved external symbol". I wonder if it is
possible to work with DirectX - directmusic libs. Are there any ways
to wrap it?
*********************compilation errors *************************
msvc.link.dll bin\msvc-7.1\debug\threading-multi\playmusic.pyd bin
\msvc-7.1\debu
g\threading-multi\playmusic.lib
Creating library bin\msvc-7.1\debug\threading-multi\playmusic.lib
and object
bin\msvc-7.1\debug\threading-multi\playmusic.exp
playmusic.obj : error LNK2001: unresolved external symbol
_GUID_PerfMasterTempo
playmusic.obj : error LNK2019: unresolved external symbol
__imp__CoUninitialize@
0 referenced in function "void __cdecl `anonymous
namespace'::StartPlay(void)" (
?StartPlay@?A0xc386fc44@@YAXXZ)
playmusic.obj : error LNK2001: unresolved external symbol
_CLSID_DirectMusicSegm
ent
playmusic.obj : error LNK2001: unresolved external symbol
_IID_IDirectMusicSegme
nt8
playmusic.obj : error LNK2001: unresolved external symbol
_GUID_DirectMusicAllTy
pes
playmusic.obj : error LNK2001: unresolved external symbol
_CLSID_DirectMusicPerf
ormance
playmusic.obj : error LNK2001: unresolved external symbol
_IID_IDirectMusicPerfo
rmance8
playmusic.obj : error LNK2019: unresolved external symbol
__imp__CoCreateInstanc
e_at_20 referenced in function "void __cdecl `anonymous
namespace'::StartPlay(void)
" (?StartPlay@?A0xc386fc44@@YAXXZ)
playmusic.obj : error LNK2001: unresolved external symbol
_CLSID_DirectMusicLoad
er
playmusic.obj : error LNK2001: unresolved external symbol
_IID_IDirectMusicLoade
r8
playmusic.obj : error LNK2019: unresolved external symbol
__imp__CoInitialize_at_4
referenced in function "void __cdecl `anonymous
namespace'::StartPlay(void)" (?S
tartPlay@?A0xc386fc44@@YAXXZ)
bin\msvc-7.1\debug\threading-multi\playmusic.pyd : fatal error
LNK1120: 11 unres
olved externals
call "C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\bin\vcvars3
2.bat" >nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /subsystem:console /out:"bin
\msvc-7.1\d
ebug\threading-multi\playmusic.pyd" /IMPLIB:"bin\msvc-7.1\debug
\threading-multi\
playmusic.lib" /LIBPATH:"C:\Panda3D-1.4.0\python\libs" @"bin
\msvc-7.1\debug\th
reading-multi\playmusic.pyd.rsp"
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
if exist "bin\msvc-7.1\debug\threading-multi
\playmusic.pyd.manifest" (
mt -nologo -manifest "bin\msvc-7.1\debug\threading-multi
\playmusic.p
yd.manifest" "-outputresource:bin\msvc-7.1\debug\threading-multi
\playmusic.pyd;2
"
)
...failed msvc.link.dll bin\msvc-7.1\debug\threading-multi
\playmusic.pyd bin\msv
c-7.1\debug\threading-multi\playmusic.lib...
...removing bin\msvc-7.1\debug\threading-multi\playmusic.lib
...failed updating 2 targets...
******************************************compiliation
errors**************
In C++, Inside "playmusic.cpp", it needs to include following
DirectMusic libs. The link errors mainly related to directmusic
stuff.
#include <dmusicc.h>
#include <dmusici.h>
#include <dmusicf.h>
************* playmusic.cpp*************************
#include <boost/python/class.hpp>
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include "boost/python/detail/wrap_python.hpp"
//using namespace std;
#include <windows.h>
#include <dmusicc.h>
#include <dmusici.h>
#include <dmusicf.h>
namespace {
//-----------------------------------------------------------------------------
// Defines, constants, and global variables
//-----------------------------------------------------------------------------
void StartPlay();
IDirectMusicLoader8* g_pLoader = NULL;
IDirectMusicPerformance8* g_pPerformance = NULL;
IDirectMusicSegment8* g_pSegment = NULL;
FLOAT fTempo;
void StartPlay() {
// Initialize COM
CoInitialize(NULL);
// Create loader object
CoCreateInstance( CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC,
IID_IDirectMusicLoader8, (void**)&g_pLoader );
.............
.............
namespace python = boost::python;
BOOST_PYTHON_MODULE(playmusic)
{
python::def("StartPlay", StartPlay);
}
*********** playmusic.cpp***************************
The code in void StartPlay() inside "playmusic.cpp" can be compiled
and executed successfully before in C++, so I extract that part.
Any ideas? Thanks so much for your help
---------------------------------
Yahoo! ¥þ·s¤É¯Åºô¤W¬Ûï¡AÅý§A¥Ñ¬Û¤ù¤¤¤À¨É¥Í¬¡ÂIºw! ¥ß§Y¥þ±¸Õ¥Î
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk