Menu
Home
Create new Paste
Log in
Code
Theme: cobalt
Theme: eclipse
Theme: elegant
Theme: monokai
Theme: neat
Theme: night
Theme: rubyblue
// // dmd myplugin.d myplugin.def -ofml_myplugind.dll -L/IMPLIB // copy ml_myplugind.dll to 'C:\Program Files (x86)\Winamp\Plugins' // import std.c.windows.windows; import core.sys.windows.dll; import std.string; extern(C) { struct winampMediaLibraryPlugin { int _version; const(char) *description; extern (C) int function() init; extern (C) void function() quit; extern (C) INT_PTR function(int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3) MessageProc; HWND hwndWinampParent; HWND hwndLibraryParent; HINSTANCE hDllInstance; } const MLHDR_VER = 0x15; } auto plugin = winampMediaLibraryPlugin( MLHDR_VER, "My Cool plugin D", &Init, &Quit, &MessageProc, cast(HWND) 0, cast(HWND) 0, cast(HINSTANCE)0 ); __gshared HINSTANCE g_hInst; extern (Windows) BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved) { switch (ulReason) { case DLL_PROCESS_ATTACH: g_hInst = hInstance; dll_process_attach(hInstance, true); break; case DLL_PROCESS_DETACH: dll_process_detach(hInstance, true); break; case DLL_THREAD_ATTACH: dll_thread_attach(true, true); break; case DLL_THREAD_DETACH: dll_thread_detach(true, true); break; default: assert(0); } return true; } extern(C) int Init() { return 0; } extern(C) void Quit() { MessageBoxA(null, "Quit() from D".toStringz, "Message".toStringz, 0); } extern(C) INT_PTR MessageProc(int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3) { return 0; } export extern (C) winampMediaLibraryPlugin *winampGetMediaLibraryPlugin() { return &plugin; }
Result:
Compilation error
/
Return code: 1 (Hangup)
/
Compilation time:
0.13
seconds
Compilation output:
/usr/local/include/dmd2/std/c/windows/windows.d(14): Error: static assert (0) is false
Username
Message
Add comment
Paste info
Author:
Guest
Views:
201
Private:
no
Expires:
Never
Uploaded:
05.07.12 6:13
Votes
:
0
Tweet
Compilation
Compiler:
DMD 2.062
Pointer size:
m64
Actions
Download
Fork
Raw
×
Confirm
Are you sure you want to delete this paste?
There's no way back!
×
Confirm
Reason