Linker errors

In our game engine the audio and the scripting system are plugins so I have created an XACT audio plugin for our engine.

The problem is that some parts of the scripting system plugin includes xact.h because it needs access to some of the xact structures, but this causes linker errors for the scripting system because xact.h contains a macro that uses CoCreateInstance.

Would it be possible to have #ifdef NOMACROS around the macros so they can be easily disabled.

Best regards

Steen L. Nielsen

www.flux-studios.com



Answer this question

Linker errors

  • GhostTown

    Hi Dugan,

    Thank you for the quick respond and sorry about the late answer.

    To answer question 1 and 2, our engine consist of a small .exe that loads a number of DLL's, each DLL handles a specific task, like rendering, audio and scripting. The small .exe files links with ole32.lib and also our XACT_audio.dll links with ole32.lib, but the DLL that handles the scripting does not, but it does include xact.h.

    Making the inlined XACTCreateEngine function static fixed our problem.

    I have found that it is no longer enough for us just to have access to the data structures, we also need to use some of the inlined functions in xact.h.

    Regards

    Steen L. Nielsen


  • djonexx

    Hi Steen. Just so I understand the problem exactly:

    1. Your engine doesn't link with the ole32.lib import library, so you can't use CoCreateInstance.
    2. Just by including xact.h you hit this linker error, even if you don't call XACTCreateEngine anywhere in your engine code.

    Is that right

    If so, it's a little odd. I would expect the linker to drop the XACTCreateEngine inline function if it's never called. We could look into making it static, so that no out-of-line object code would be generated for it. As a quick workaround, you might want to try editing your xact.h file and adding the static keyword to see if this fixes your error.

    Another question: which XACT definitions do you need to use If it seems to be a common scenario, perhaps we should support an XACT_DATA_ONLY macro that only gave you these definitions.

    Thanks,
    Dugan Porter - Game Audio Team - Microsoft
    This posting is provided "as is" with no warranties, and confers no rights



  • Linker errors