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 version(FLP) 48 { 49 import dplug.flp; 50 mixin(FLPEntryPoint!` ~ ClientClass.stringof ~ `); 51 }`; 52 } 53 54 // Dynamic libraries entry point. 55 // Basically only needed on Windows, on POSIX the other entry points are sufficient. 56 57 version(Windows) 58 { 59 template DLLEntryPoint() 60 { 61 const char[] DLLEntryPoint = q{ 62 import core.sys.windows.windef; 63 import core.sys.windows.dll; 64 extern (Windows) BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved) 65 { 66 return true; 67 } 68 }; 69 } 70 } 71 else 72 { 73 template DLLEntryPoint() 74 { 75 const char[] DLLEntryPoint = ``; 76 } 77 } 78