I was going around in circles with the /TP and /clr (and variant)
options, so I went back to a fresh copy of the Windows Forms project.
I take it pm_dll.dll is still the recommended approach for PortMIDI
on Windows, so I added #include "portmidi.h" to stadfx.h and followed
the instructions at <http://msdn2.microsoft.com/en-us/library/ba1z7822
(VS.80).aspx> to point the linker to pm_dll.lib (distinguishing
between the appropriate versions of the .lib for my Debug & Release
build configurations).
At that point the appliction built, but was obviously not calling any
PM code yet. So I then added a call to Pm_Initialize() in with other
initialization code in my Form1.h. Now I'm getting linker errors:
test.obj : error LNK2028: unresolved token (0A000045) "extern "C"
enum PmError __cdecl Pm_Initialize(void)" (?Pm_Initialize@@$$J0YA?
AW4PmError@@XZ) referenced in function "public: __clrcall
test::Form1::Form1(void)" ([EMAIL PROTECTED]@@[EMAIL PROTECTED])
test.obj : error LNK2019: unresolved external symbol "extern "C"
enum PmError __cdecl Pm_Initialize(void)" (?Pm_Initialize@@$$J0YA?
AW4PmError@@XZ) referenced in function "public: __clrcall
test::Form1::Form1(void)" ([EMAIL PROTECTED]@@[EMAIL PROTECTED])
I am confused about the __cdecl/__declspec business. MS documentation
seems to want the DLL project to use the latter, but the PortMIDI
project uses good, old-fashioned C storage-class attributes without
the funky MS inventions. Pm_Initialize() should be implicitly extern,
that's all.
Also, the linker diagnostics make it look as if the function name has
been mangled despite the extern "C" declaration.
Is this stuff that I need to worry about?
Also, a question to Roger: does using the DLL approach mean that I do
not need to explicitly call Pm_Terminate() in my own code? The DLL is
supposed to clean up if my app crashes, so I'm extrapolating that it
will clean up when my app exits normally. Or should I Pm_Terminate()
anyway to be a good citizen?
I'm out for a few hours. Maybe someone can tell me I'm doin'
somethin' stoopid in the meantime.-)
Thanks,
Peter
-------------- http://www.bek.no/~pcastine/Litter/ -------------
Peter Castine +--> Litter Power & Litter Bundle for Jitter
Universal Binaries on the way
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|
http://www.dspaudio.com/ http://www.castine.de
_______________________________________________
media_api mailing list
[EMAIL PROTECTED]
http://www.create.ucsb.edu/mailman/listinfo/media_api