The following is a complete program that loads DerelictAL:
import derelict.openal.al; void main() { DerelictAL.load(); // now you can call OpenAL functions }
From this point on, you may call OpenAL functions as normal. Additionally, because not all applications will need the alu* functions, the loading of these functions has been separated from the rest of the OpenAL functions. This is so that DerelictAL.load will not fail if any alu* functions are missing and you don't need them anyway. As such, you must make a call to DerelictAL.loadALU in order to load the alu* functions. As noted above, these functions are currently only available on Windows. You can call DerelictAL.load() in a platform-indpendent manner, but you should wrap any calls to DerelictALU functions in a version(Windows) block.
import derelict.openal.al; void main() { DerelictAL.load(); DerelictALU.load(); // call OpenAL functions version(Windows) { // call alu* functions } }
As with other Derelict packages, DerelictAL will throw an exception if an error occurs while loading the shared library. For more information on Derelict exceptions, see the documentation for Loading/Unloading Shared Libraries.
Finally, the method DerelictAL.unload() is provided for convenience. In normal practice you do not need to call this function, as Derelict will unload the library automatically when the app exits. You generally should only use this function if you need to unload DerelictAL while the application is running.