C# DllImport reference files

Up front, we need to maintain a code base that works for AutoCAD and BricsCAD.

I'm currently doing this through compilation symbols and #if, #elif and #endif (see code block below).

Our customisation also goes outside our organisation and 'installation' paths may be unpredictable because of local IT... preferences.

I've found some code that hopefully will enable our AutoCAD/BricsCAD customisation to not be bound to fixed paths in a profile.

There's a reference to "accore.dll" for the AutoCAD code I found.
#if ARX_APP
        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("accore.dll", EntryPoint = "acedInvoke",
            CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
        extern static private int acedInvoke(IntPtr args, out IntPtr result);
#elif BRX_APP
        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("???????.dll", EntryPoint = "acedInvoke",
            CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
        extern static private int acedInvoke(IntPtr args, out IntPtr result);
#endif
Obviously I can't use "accore.dll" in the BRX_APP #elif block.

I note there are a lot of "*_core.dll" files in the BricsCAD install.
  • Some of them I can see aren't relevant to what I'm chasing
    • bdm_core.dll : Bricscad Mechanical extension (x64)
    • bim_core.dll : Bricscad BIM Module (x64)
    • civil_core.dll
    • sm_core : BricsCAD Mechanical Extension (x64)
  • There are a few that present a "File description" of "BricsCAD Extension (x64)" that leaves it open whether it's what I'm after.
    • bgc_core.dll
    • mu_core.dll
There are a few others.

Is there one of the installed dll files that I should target, or are none of them what I'm after.

I also expect that the "EntryPoint" may not be "acedInvoke". If not, what should it be?

Comments

  • The acedInvoke() function is part of the BRX SDK, so exported from brx23.dll.
  • Its_Alive
    edited November 2022
    BTW, acedInvoke is wrapped
    ResultBuffer Bricscad.Global.Editor.Invoke(ResultBuffer args);

    edit, in fact, you must use the provided wrapper as ResultBuffer wraps OdResBuf and not BRX resbuf
  • Thank-you AbbyNormal.

    That's exactly the pointer I needed.

    I haven't tripped over an equivalent wrapping for AutoCAD, but the other method works there and is all I've found for doing the job.