Hello
I need to use in my (unmanaged C++) program some functionality which is easy to get in C#.
To test for feasibility, I decided to try a very basic example available at Microsoft:
- build a C# DLL containing an interface and a simple public method which adds two numbers.
- register it
- in the ARX project import the type library and acces the DLL like so:
HRESULT hr = CoInitialize(NULL); IGetDocText* pGetDocText (__uuidof(CGetDocText)); // use the ADD API long result = 0; hr = pGetDocText>Add(10, 20, &result); // Release the COM interface CoUninitialize();
If I I use the clr oldSyntax switch as per MS recommendation, I get a zillion errors, all like:
c:\!dev\objectarx 2008\inc\mgdinterop.h(166) : error C2039: 'Vector3d' : is not a member of 'Autodesk::AutoCAD'
If I use the No clr support switch, it errors on:
.error C2440: 'initializing' : cannot convert from 'const _GUID' to 'GetDocText::IGetDocText *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
which seems logical to me.
As this is my 1st time at managed code usage in ARX, I could use a few hints, please.
Thanks
Solved! Go to Solution.
Solved by alex_b. Go to Solution.
Hi Daniel.
For one, I am not that fluent in interop and .net to dare do what you suggest.
Anyway, I solved the problem.
I was led awry by a Microsoft document stating that the unmanaged code should be compiled with /clr:oldSyntax switch.
As soon I got rid of it, it compiled OK.
Thanks
alex