cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
benny_
Participant

C# extensions

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?

2 Replies 2
scottjm
Mentor

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++.

 

 

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe
rwessel
Booster

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.

Central Innovation Ltd

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!