cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad C++ API
About Archicad add-on development using the C++ API.

Proper way of including Dynamic Libraries

stefan
Advisor
What is the proper way to install an add-on which uses Dynamic Libraries? (DLL on Windows, dylib on OSX).


Specifically on OSX: should they be embedded in the Bundle? Or placed in the same folder as the bundle? In the ArchiCAD Root or Support folder?

e.g. I see for the Rhino add-in, that the "dylib" for OpenNURBS is installed in the ArchiCAD Support folder and that the library has an @rpath/ install name.

Are we allowed to put our dylibs there? Would it be better to have them alongside our own bundle?

I prefer to have an Add-on that is self-contained.
--- stefan boeykens --- bim-expert-architect-engineer-musician ---
Archicad27/Revit2023/Rhino8/Unity/Solibri/Zoom
MBP2023:14"M2MAX/Sonoma+Win11
Archicad-user since 1998
my Archicad Book
4 REPLIES 4
Oleg
Expert
My AddOn is a Win only and uses DLLs.
I dont know the best way.
I use the following:

Add-Ons
    MyAddonFolder
        addon_file.apx
        (subfolder)
            file1.dll
            file2.dll
PS:
Subfolder uses parentheses as archicad dont look inside.

Addition:
I use dynamic linking for DLLs ( LoadLibraryEx and GetProcAddress ).
For static linking DLL place is more limited.
Akos Somorjai
Graphisoft
Graphisoft
stefan wrote:
What is the proper way to install an add-on which uses Dynamic Libraries? (DLL on Windows, dylib on OSX).


Specifically on OSX: should they be embedded in the Bundle? Or placed in the same folder as the bundle? In the ArchiCAD Root or Support folder?

e.g. I see for the Rhino add-in, that the "dylib" for OpenNURBS is installed in the ArchiCAD Support folder and that the library has an @rpath/ install name.

Are we allowed to put our dylibs there? Would it be better to have them alongside our own bundle?

I prefer to have an Add-on that is self-contained.
On OS X the preferred way is to put the dylib into the bundle, according to Apple's guidelines. You'll have to set up the root of the @rpath correctly, unless you wan to load the dylib manually via dlopen().

Best, Ákos
Anonymous
Not applicable
Akos wrote:
stefan wrote:
What is the proper way to install an add-on which uses Dynamic Libraries? (DLL on Windows, dylib on OSX).


Specifically on OSX: should they be embedded in the Bundle? Or placed in the same folder as the bundle? In the ArchiCAD Root or Support folder?

e.g. I see for the Rhino add-in, that the "dylib" for OpenNURBS is installed in the ArchiCAD Support folder and that the library has an @rpath/ install name.

Are we allowed to put our dylibs there? Would it be better to have them alongside our own bundle?

I prefer to have an Add-on that is self-contained.
On OS X the preferred way is to put the dylib into the bundle, according to Apple's guidelines. You'll have to set up the root of the @rpath correctly, unless you wan to load the dylib manually via dlopen().

Best, Ákos
Waht would be the best practice for windows?
Akos Somorjai
Graphisoft
Graphisoft
mar_kq wrote:
Waht would be the best practice for windows?
Well, the default search path for DLLs on Windows is the application and the system directories. So if you want to be self contained then place the DLLs beside your add-on. In this case you have to load each DLL manually and get the function pointers' addresses to be able to call them (like Oleg suggested). The other way is to place your DLLs beside ARCHICAD — in this case your DLLs can be called the same way as you call the system DLLs, but we don't consider that very nice

Best, Ákos

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!