Old 21st December 2010, 23:12   #1
YoshiMCF
Junior Member
 
Join Date: Dec 2010
Posts: 2
Duplicate function definitions

I'm trying to create a Winamp plugin to play an obscure audio format. I started with the in_raw example from the SDK, but when I try to include the code that decodes this format, I get linker errors:
code:
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _sprintf already defined in LIBCMTD.lib(sprintf.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _tolower already defined in LIBCMTD.lib(tolower.obj)
...



It looks to me like MSVCRTD.lib and LIBCMTD.lib are both defining sprintf and a bunch of other basic functions. So I went into the project's properties->Linker->Input, and under Ignore Specific Library, I added MSVCRTD.lib. This caused a huge number of other functions to no longer be defined. I removed that, and added LIBCMTD.lib instead. That allowed the plugin to compile. However, Winamp loads and then almost immediately unloads my DLL (still called in_raw.dll):
code:
'winamp.exe': Loaded 'C:\Program Files (x86)\Winamp\Plugins\in_nsv.dll', Binary was not built with debug information.
'winamp.exe': Loaded 'C:\Program Files (x86)\Winamp\Plugins\in_raw.dll', Symbols loaded.
'winamp.exe': Loaded 'C:\Windows\SysWOW64\d3d9.dll'
'winamp.exe': Loaded 'C:\Windows\SysWOW64\version.dll'
...
'winamp.exe': Loaded 'C:\Windows\SysWOW64\hid.dll'
'winamp.exe': Unloaded 'C:\Program Files (x86)\Winamp\Plugins\in_raw.dll'



Does anyone have any advice on how to solve this problem? Is there a way to get Winamp to output debugging information as to why it's unloading my dll?

Thanks!
YoshiMCF is offline   Reply With Quote
Old 22nd December 2010, 08:17   #2
DrO
 
Join Date: Sep 2003
Posts: 27,873
the linker issue is from your library using a different crt from what is sent in the somewhat outdated project settings of in_raw.

as for the load then unload thing, make sure that the required dll export is correctly defined as extern "C" if you are using a cpp file. you can use http://www.dependencywalker.com/ to make sure the export isn't mangled as that is the normal cause for the plug-in loading to not work.

-daz
DrO is offline   Reply With Quote
Old 27th December 2010, 18:41   #3
YoshiMCF
Junior Member
 
Join Date: Dec 2010
Posts: 2
Thanks, DrO. Starting from an existing project I had that uses the decryption I wanted to use already instead of in_raw fixed that linker issue.

I did remember to extern "C" the dll export, and it wasn't mangled according to the dependency walker. It looks like the issue is that the decryption code already has a way to play this type of file through DirectSound, and that's what's causing Winamp to choke on my plugin. Removing all the references to that stopped Winamp from unloading my plugin, and I should be able to get it playing from here.

Thanks again!
YoshiMCF is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Tags
libcmtd.lib, msvcrtd.lib

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump