2025-11-26 11:56 AM
I've been investigating whether it's possible to essentially create an extension to ArchiCAD that is written in C# by having a C++/CLI bridge from C++ to C#, but I'm a bit stuck.
I was wondering if anyone has tried this before and have any experience they can share?
Essentially, I need C++ to initialize a C# object and then provide it with callbacks to C++ so they can interoperate bidirectionally. This works fine for callbacks that return simple types, but for any complex types, it falls apart and I get a memory access violation when the C# context takes ownership of the C++/CLI initialized object through the return value of the callback function.
I've also been told to ask if there are plans to add support for C# extensions or some sort of native interop with C# in ArchiCAD?
2025-11-27 01:59 AM
That sounds like it would be extremely complicated if you did get it to work, and its likely easier to write your addon all in C++. You are not going to be able to access any of the Archicad C++ API functions directly, so you would have to have some kind of bridge for every function as you mentioned.
I would doubt very much if there would ever be any plans for direct C# support in APIs, given all the main archicad platform is written in C++.
2025-11-30 03:20 PM
No, this isn't possible. It a platform issue rather than language - C# is dependent on the .net platform and can't directly interact with anything that isn't. Otherwise, when running entirely within .net, C# and C++ (and many other languages) can interact relatively easily.