[Openal] I don't understand why my code wont compile

Chris Robinson chris.kcat at gmail.com
Thu Mar 12 19:24:13 PDT 2009


On Thursday 12 March 2009 12:52:17 pm Margin Marh wrote:
> How do i build the lib myself or load the functions dynamically?
> Thanks in advance.

To build it yourself, you'll need to use CMake <http://cmake.org/>. With that, 
you can create an MSVC project file, then build a lib with that. Get the 
ALURE's source from <http://kcat.strangesoft.net/alure.html>, and follow the 
Source Install instructions. After running CMake, load the project file into 
MSVC, and build it. You should then be able to copy out the built ALURE32.lib, 
then delete the source folder.

Alternatively, dynamically loading it isn't too difficult:

namespace alure {
    HMODULE handle;
    LPALUREGETERRORSTRING GetErrorString;
    LPALUREGETVERSION GetVersion;
    LPALUREGETDEVICENAMES GetDeviceNames;
    LPALUREFREEDEVICENAMES FreeDeviceNames;
    LPALUREINITDEVICE InitDevice;
    LPALURESHUTDOWNDEVICE ShutdownDevice;
    LPALUREGETSAMPLEFORMAT GetSampleFormat;
    LPALURESLEEP Sleep;
    LPALURECREATEBUFFERFROMFILE CreateBufferFromFile;
    LPALURECREATEBUFFERFROMMEMORY CreateBufferFromMemory;
    LPALUREBUFFERDATAFROMFILE BufferDataFromFile;
    LPALUREBUFFERDATAFROMMEMORY BufferDataFromMemory;
    LPALURECREATESTREAMFROMFILE CreateStreamFromFile;
    LPALURECREATESTREAMFROMMEMORY CreateStreamFromMemory;
    LPALURECREATESTREAMFROMSTATICMEMORY CreateStreamFromStaticMemory;
    LPALURECREATESTREAMFROMCALLBACK CreateStreamFromCallback;
    LPALUREBUFFERDATAFROMSTREAM BufferDataFromStream;
    LPALUREREWINDSTREAM RewindStream;
    LPALUREDESTROYSTREAM DestroyStream;
    LPALUREINSTALLDECODECALLBACKS InstallDecodeCallbacks;
};

...then during init...

alure::handle = LoadLibrary("ALURE32.dll");
if(alure::handle == NULL)
{
    fprintf(stderr, "Failed to load ALURE32.dll\n");
    exit(1);
}
alure::GetErrorString = GetProcAddress(alure::handle, "alureGetErrorString");
alure::GetVersion = GetProcAddress(alure::handle, "alureGetVersion");
alure::GetDeviceNames = GetProcAddress(alure::handle, "alureGetDeviceNames");
...
and so-on for all the functions you need. Perhaps I should make an example 
with copy/paste-able code to do this for ALURE 1.1...


More information about the Openal mailing list