|
|
#1 |
|
Junior Member
|
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! |
|
|
|
|
|
#2 |
|
Banned
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. |
|
|
|
|
|
#3 |
|
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; } |
|
|
|
|
|
#4 |
|
Junior Member
|
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 |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|