http://ftp.dlang.org/ctg/implib.html

The above URL suggests that, on Windoze, I can create a D compatible lib from a dll file by issuing the command:

    implib /s dsound.lib dsound.dll

The following file:

    sound.d
    =======
    pragma(lib, "dsound")
    struct IDirectSound{};
    alias LPDIRECTSOUND = IDirectSound*;
    extern(Windows) HRESULT
        DirectSoundCreate(LPGUID, LPDIRECTSOUND*, LPUNKNOWN);

    void main()
    {
        LPDIRECTSOUND directSound;
        DirectSoundCreate(null, &directSound, null);
    }

compiled as such:

    dmd sound dsound.lib

produces the output:

    OPTLINK (R) for Win32  Release 8.00.17
    Copyright (C) Digital Mars 1989-2013  All rights reserved.
    http://www.digitalmars.com/ctg/optlink.html
    sound.obj(sound)
     Error 42: Symbol Undefined _DirectSoundCreate@12
    --- errorlevel 1

Obviously I'm doing something incorrectly but I'm unable to see it. Please shed some light.

The only thing I can see is that IDirectSound8 is improperly declared. It is struct generated form an interface which I have now idea of how to bind to from D:

https://gist.github.com/AndrewEdwards/560601a62ea890842ecac90bb41896a8#file-dsound-h-L214

Thanks,
Andrew

Reply via email to