Old 20th January 2001, 03:09   #1
Felix_Draconis
Junior Member
 
Join Date: Jan 2001
Posts: 2
Send a message via ICQ to Felix_Draconis
I've used the 'tutorial' provided in the General plugins and reduced it down to the core components (thanks to another Delphi tutorial I found) which are just enough to get it listed in the plugin list in WinAMP. Which is fine and works great.

However, once I convert the project to C++ (rename to .cpp and start adding in other Windows headers) it immediately stops showing up in WinAMP.

I can only assume that for some reason WinAMP doesn't want to communicate with my c++-enabled plugin, but I really don't know why. Can anyone enlighten me to this being true or suggest a workaround? I need the extensions in order to support XML and some other funky stuff.

Thanks!
Felix_Draconis is offline   Reply With Quote
Old 22nd January 2001, 14:15   #2
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
Not really a reply, but a request!

Hey! Where did you find that Delphi stuff. I wan't it now!!
Please! (I'm desperate :-) ).


Since I really have to reply:

What I think Is the problem with your C++ code, is that it may use parts of the Object Pascal (something left out, check all types, structures, entry points). You can never be sure enough, whether your code is bug free or not. Check, check, check.
saivert is offline   Reply With Quote
Old 23rd January 2001, 10:42   #3
Vassili Bourdo
Junior Member
 
Join Date: Aug 2000
Location: Minsk, Belarus
Posts: 3
Your problem is that C++ compiler uses "decorated" names for functions. As result, the name of plugin entry functionname will look like "winampGetGeneralPurposePlugin@AA_BSDFF".

You can fix it by specifying "extern "C"" in front of before function name. Example follows:

extern "C"
winampGeneralPurposePlugin* winampGetGeneralPurposePlugin()
{
return &pluginData;
}
Vassili Bourdo is offline   Reply With Quote
Old 23rd January 2001, 22:40   #4
Felix_Draconis
Junior Member
 
Join Date: Jan 2001
Posts: 2
Send a message via ICQ to Felix_Draconis
Excellent. That extern "c" cleared things up right away!

For anyone else curious, here's my working source code for a bare-bones gen_dll... This should be everything.

>>>>>>> header
typedef struct {
int version;
char *description;
int (*init)();
void (*config)();
void (*quit)();
HWND hwndParent;
HINSTANCE hDllInstance;
} winampGeneralPurposePlugin;

#define GPPHDR_VER 0x10

extern winampGeneralPurposePlugin *gen_plugins[256];
typedef winampGeneralPurposePlugin * (*winampGeneralPurposePluginGetter)();

>>>>>>>> code file
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}

void config();
void quit();
int init();

winampGeneralPurposePlugin plugin =
{
GPPHDR_VER,
"Control Test",
init,
config,
quit,
};

void config()
{
}

void quit()
{
}

int init()
{
return 0;
}

extern "C"
__declspec( dllexport ) winampGeneralPurposePlugin * winampGetGeneralPurposePlugin()
{
return &plugin;
}


And here is that Delphi tutorial I mentioned - it's from another message on here:

http://www.stnd.de
Felix_Draconis is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Winamp > Winamp Technical Support

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