Building an Application

An application that uses the AcBr library must have the library file acbr24.dbx available to link against.

More importantly, the library is needed to ensure proper registration of the AcBr classes with ObjectARX at runtime.

Therefore it is important that acbr24.dbx be explicitly loaded by the application, if it has not already been loaded by the modeler or another application. The best way to ensure this is to use acrxDynamicLinker() and acrxClassDictionary() to load acbr24.dbx and to check if it has been loaded.

The following code fragment provides an example:

extern "C" AcRx::AppRetCode
acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)
{
    switch (msg) {
    case AcRx::kInitAppMsg:
        if (!acrxClassDictionary->at("AcBrEntity")) {
                acrxDynamicLinker->loadModule("acbr24.dbx", 1);
                acutPrintf("\nacbr24 loaded \n");
            }
        acedRegCmds->addCommand(
            "MY_APP",
            "MY_CMD",
            "MY_CMD",
            ACRX_CMD_MODAL,
            &myCmdImp);
        acrxUnlockApplication(pkt); // try to allow unloading
        break;
    case AcRx::kUnloadAppMsg:
        acedRegCmds->removeGroup("MY_APP");
        break;
    default:
        break;
    }
    return AcRx::kRetOK;
}
Note: It is important not to unload acbr24.dbx upon exit from an application, as other applications (or the modeler) may still depend on its presence.