1 /** 2 * Entry points. 3 * 4 * Copyright: Guillaume Piolat 2015-2016. 5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) 6 */ 7 module dplug.client.dllmain; 8 9 /// The one entry point mixin you need 10 /// Just paste `mixin(pluginEntryPoints!MyPluginClient);` into your main file for a plug-in. 11 string pluginEntryPoints(ClientClass)() 12 { 13 return 14 ` 15 mixin(DLLEntryPoint!()); 16 17 version(VST2) 18 { 19 import dplug.vst2; 20 mixin(VST2EntryPoint!` ~ ClientClass.stringof ~ `); 21 } 22 23 version(AU) 24 { 25 import dplug.au; 26 mixin(AUEntryPoint!` ~ ClientClass.stringof ~ `); 27 } 28 29 version(VST3) 30 { 31 import dplug.vst3; 32 mixin(VST3EntryPoint!` ~ ClientClass.stringof ~ `); 33 } 34 35 version(AAX) 36 { 37 import dplug.aax; 38 mixin(AAXEntryPoint!` ~ ClientClass.stringof ~ `); 39 } 40 41 version(LV2) 42 { 43 import dplug.lv2; 44 mixin(LV2EntryPoint!` ~ ClientClass.stringof ~ `); 45 }`; 46 } 47 48 // Dynamic libraries entry point. 49 // Basically only needed on Windows, on POSIX the other entry points are sufficient. 50 51 version(Windows) 52 { 53 template DLLEntryPoint() 54 { 55 const char[] DLLEntryPoint = q{ 56 import core.sys.windows.windef; 57 import core.sys.windows.dll; 58 extern (Windows) BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved) 59 { 60 return true; 61 } 62 }; 63 } 64 } 65 else 66 { 67 template DLLEntryPoint() 68 { 69 const char[] DLLEntryPoint = ``; 70 } 71 } 72