C++/CLI AddIn for Solid Edge

 

I've just been playing around with the possiblity of using C++/CLI (Managed C++ in VS2005) with a Solid Edge AddIn.

I got a very simple example working and have attached the project (you will probably need VS2005 Service Pack 1 installed to use the project as is).

 

Up until now I've been doing a lot of stuff by calling .Net dlls that have been registered for COM from my AddIn code in C++. This allowed me to use all that nice xml/sql etc. stuff from the FCL and still have a stable AddIn.

 

In the project there are two managed methods (in interop.cpp) and the usual AddIn classes (cut down to the minimum). I found that I couldn't include a managed header in the AddIn classes as I would get a load of errors. Instead of spending ages trying to figure out how to get rid of the errors I went straight to a 'work around' that actually keeps things nicely seperated.

I have declared two global functions in stdafx.h and implemented them in interop.cpp. This meant that I could call them from anywhere, but it also meant that I have a very definite separation of managed and native code. It also forced me to define a sort of interface of the methods that I want to call across the managed/native boundary, meaning that generally a bit more thought gets put into defining these methods, and it will probably make things easier to debug if any interop problems arise.

 

Anyway, now I finally have a stable AddIn with access to all of those handy .Net classes

 

Cheers

Calum

 

Posted by: Calum McLellan
Post date: 4/26/2007 9:44:43 PM