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