471,305 Members | 1,217 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,305 software developers and data experts.

boost.python error with DirectX

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@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@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...

******************************************compilia tion
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

Oct 1 '07 #1
0 1399

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Li Daobing | last post: by
4 posts views Thread by JDJMSon | last post: by
3 posts views Thread by TonyHa | last post: by
4 posts views Thread by Shawn McGrath | last post: by
6 posts views Thread by Soren | last post: by
2 posts views Thread by deepest1 | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.