www.digitalmars.com         C & C++   DMDScript  

c++ - Problems linking to winmm.lib

reply "Gregory Peet" <admin gregpeet.com> writes:
Greetings, I hope someone can remove the cloud over my project.

I am trying to use the multimedia function:
BOOL PlaySound(

    LPCSTR pszSound,
    HMODULE hmod,
    DWORD fdwSound
   );

Which is delcared within mmsystem.h.
I have tried implib'ing all multimedia libraries from the system32 directory
(this includes winmm.dll, mmsystem.dll). I am stuck! I've used the /system
switch with the implib tool and tried linking against the files over and
over. The result is always the same:

greg# dmc testwin.c winmm.lib gdi32.lib mmsystem.lib
link testwin,,,winmm+gdi32+mmsystem+user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

testwin.obj(testwin)
 Error 42: Symbol Undefined _PlaySoundA 12

--- errorlevel 1

I have tried compiling "as is" with borland and the results are success.
-- 
-Gregory Peet

STLSoft FAQ:
http://stlsoft.gregpeet.com

Golden Rule of Open-Source Programming:
"Don't whine about something unless you are going to implement it yourself."
May 29 2003
next sibling parent reply "Gregory Peet" <admin gregpeet.com> writes:
Below is the smallest possible code I can use to give an example. Try
compiling this, if you can get it to work, please post how you did it. I can
get this to compile on other compilers except dmc. Make sure you have the
chimes.wav (c:\windows\media\chimes.wav)  in your directory:

#include <windows.h>
#include <mmsystem.h>

int main()
{
    PlaySound("chimes.wav", NULL, SND_FILENAME);
    return(0);
}
May 29 2003
next sibling parent reply Richard Grant <fractal clark.net> writes:
In article <bb666j$1u07$1 digitaldaemon.com>, Gregory Peet says...
Below is the smallest possible code I can use to give an example. Try

Try linking with winmm.lib Richard
May 29 2003
parent reply "Gregory Peet" <admin gregpeet.com> writes:
Do you mean a winmm.lib that comes with the retail version? I haven't
received the CD yet. I have been trying to link with a winmm.lib I imported
from the dll under system32.

"Richard Grant" <fractal clark.net> wrote in message
news:bb6iq5$77l$1 digitaldaemon.com...
 In article <bb666j$1u07$1 digitaldaemon.com>, Gregory Peet says...
Below is the smallest possible code I can use to give an example. Try

Try linking with winmm.lib Richard

May 29 2003
parent "Nic Tiger" <tiger7 progtech.ru> writes:
The problem is that Windows doesn't use  n decoration for it's internal
DLLs, so simply implibing winmm.dll doesn't help.

Nic Tiger.

"Gregory Peet" <admin gregpeet.com> wrote in message
news:bb6iuk$aep$1 digitaldaemon.com...
 Do you mean a winmm.lib that comes with the retail version? I haven't
 received the CD yet. I have been trying to link with a winmm.lib I

 from the dll under system32.

 "Richard Grant" <fractal clark.net> wrote in message
 news:bb6iq5$77l$1 digitaldaemon.com...
 In article <bb666j$1u07$1 digitaldaemon.com>, Gregory Peet says...
Below is the smallest possible code I can use to give an example. Try

Try linking with winmm.lib Richard


May 29 2003
prev sibling parent Richard Grant <fractal clark.net> writes:
In article <bb666j$1u07$1 digitaldaemon.com>, Gregory Peet says...

ooops. I see you tried with winmm.lib. Not sure, but your sample compiled fine
for me.

If you have dmc libunres, you can try to see if the lib has the routine:

C:\dm\lib>libunres /p winmm.lib

..
_PlaySound 12
_PlaySoundA 12
_PlaySoundW 12

Richard
May 29 2003
prev sibling parent reply "Gregory Peet" <admin gregpeet.com> writes:
Thanks to all. I know that the dll doesn't have the needed decoration, I was
just trying with hopeful aspirations. The lib file isn't even useable
(nothing is listed with libunres - fatal opening error lol). I will just
have to wait for the cd to arrive. I don't much care for installing the
*huge/bulky* win32 PSDK for just one file. Who says my apps need sound
anyway...at least for now =P

-- 
-Gregory Peet

STLSoft FAQ:
http://stlsoft.gregpeet.com

Golden Rule of Open-Source Programming:
"Don't whine about something unless you are going to implement it yourself."
May 29 2003
parent reply "Nic Tiger" <tiger7 progtech.ru> writes:
If you want to use DirectShow later, you will have to install and setup
*huge/bulky* win32 PSDK anyway :-)

Nic Tiger.

"Gregory Peet" <admin gregpeet.com> wrote in message
news:bb6jls$1357$1 digitaldaemon.com...
 Thanks to all. I know that the dll doesn't have the needed decoration, I

 just trying with hopeful aspirations. The lib file isn't even useable
 (nothing is listed with libunres - fatal opening error lol). I will just
 have to wait for the cd to arrive. I don't much care for installing the
 *huge/bulky* win32 PSDK for just one file. Who says my apps need sound
 anyway...at least for now =P

 --
 -Gregory Peet

 STLSoft FAQ:
 http://stlsoft.gregpeet.com

 Golden Rule of Open-Source Programming:
 "Don't whine about something unless you are going to implement it


May 29 2003
parent reply "Gregory Peet" <admin gregpeet.com> writes:
True indeed, but I prefer SDL (www.libsdl.org) for 2D graphics over the
MSSDK. I also prefer OpenGL for 3D graphics over the MSSDK. My personal
opinion is that M$'s framework is terrible. Their hungarian notation isn't
even consistent and it isn't cross-platform (I could continue) =P
May 29 2003
parent Ilya Minkov <midiclub 8ung.at> writes:
Gregory Peet wrote:
 True indeed, but I prefer SDL (www.libsdl.org) for 2D graphics over the
 MSSDK. I also prefer OpenGL for 3D graphics over the MSSDK. My personal
 opinion is that M$'s framework is terrible. Their hungarian notation isn't
 even consistent and it isn't cross-platform (I could continue) =P

Very true. SDL+OpenGL is more sane, even within one platform. And OpenGL is even faster unless you load new textures too often. -i.
May 30 2003