The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Magnum on April 05, 2010, 09:43:57 PM

Title: Undefined symbol for playsound
Post by: Magnum on April 05, 2010, 09:43:57 PM
This returns with undefined symbol for PlaySound.

invoke PlaySound, addr sound, NULL, SND_FILENAME);

invoke ExitProcess,0

Title: Re: Undefined symbol for playsound
Post by: oex on April 05, 2010, 09:46:33 PM
include \masm32\include\winmm.inc
includelib \masm32\lib\winmm.lib
Title: Re: Undefined symbol for playsound
Post by: dedndave on April 05, 2010, 11:13:16 PM
the parenthesis and semicolon ");" look like C leftovers - maybe that is the undefined symbol
Title: Re: Undefined symbol for playsound
Post by: Magnum on April 06, 2010, 01:21:48 PM
Quote from: dedndave on April 05, 2010, 11:13:16 PM
the parenthesis and semicolon ");" look like C leftovers - maybe that is the undefined symbol

You are right, the parenthesis didn't belong. But the missing include and library had to be there.

Most API's have info on necessary includes, but PlaySound didn't.
PlaySound wasn't even in the 2003 SDK help files.


Title: Re: Undefined symbol for playsound
Post by: hutch-- on April 06, 2010, 11:33:23 PM
Magnum, see if you can find the reference material on MSDN online.
Title: Re: Undefined symbol for playsound
Post by: MichaelW on April 07, 2010, 03:28:43 AM
My 2003 PSDK documents it, and includes the necessary header file and import library.
Title: Re: Undefined symbol for playsound
Post by: donkey on April 07, 2010, 03:33:17 AM
oex has it right, it is exported by winmm.dll so the lib should be winmm.lib. However, it is available in both ANSI and UNICODE versions so you may have to use PlaySoundA or PlaySoundW if it is not redirected by your include file or you can do the redefinition yourself

PlaySound equ <PlaySoundA>
Title: Re: Undefined symbol for playsound
Post by: Farabi on April 07, 2010, 10:31:34 PM
anyway for the SND_MEMORY what is the image format?
Title: Re: Undefined symbol for playsound
Post by: Magnum on April 07, 2010, 10:56:02 PM
Quote from: MichaelW on April 07, 2010, 03:28:43 AM
My 2003 PSDK documents it, and includes the necessary header file and import library.

My mistake.
I was looking in the Functions by Alphabetical Order which doesn't list everything.

I found PlaySound in my SDK.