Winamp plugin
Denis Shelomovskij
verylonglogin.reg at gmail.com
Thu Jul 5 01:55:27 PDT 2012
05.07.2012 8:37, dnewbie пишет:
> I'm writing a Winamp plugin in D. Winamp loads my plugin and everything
> is fine until I close Winamp. At this point, Winamp calls the Quit()
> function of my plugin and *after* that, Winamp crashes.
>
> Here is the code.
>
> D source
> http://dpaste.dzfl.pl/e2b2f886
>
>
> myplugin.def - .DEF file
> -------------------------------
> LIBRARY "ml_myplugind.dll"
> EXETYPE NT
> SUBSYSTEM WINDOWS
> EXPORTS
> winampGetMediaLibraryPlugin
> -------------------------------
>
> Compile:
> dmd myplugin.d myplugin.def -ofml_myplugind.dll -L/IMPLIB
>
> Copy ml_myplugind.dll to 'C:\Program Files (x86)\Winamp\Plugins'
>
> Restart Winamp and go to Options -> Preferences -> Plugins -> Media
> Library.
> You'll see 'My Cool Plugin D' [ml_myplugind.dll]' that means the plugin
> was loaded.
>
> Close Winamp. You'll see a message box 'Quit() from D', from the plugin and
> MS-Windows displays a error dialog. Click more information and it says
> APPCRASH module ml_myplugind.dll.
>
> I have tried the following C code which does the same thing, and I've
> got no APPCRASHES
>
> http://pastebin.com/7t8jkfn8
>
> I can't see what is wrong. Any help is appreciated.
>
> More information about Winamp plugin:
> http://wiki.winamp.com/wiki/Media_Library_Plugin
>
What's your OS? If Windows XP, than D DLL can't be unloaded because of
non-perfect TLS fixing technique (I created a "perfect" one but I never
managed to prepare such projects for release so nobody knows about them).
And on any Windows Digital Mars C runtime behaves very nasty when it's
dynamically loaded. IIRC, it do bad things when loaded in non-main with
TLS index != 0 thread and when unloaded (IIRC, again, at least it closes
handles).
--
Денис В. Шеломовский
Denis V. Shelomovskij
More information about the Digitalmars-d-learn
mailing list