The application we are developing requires many small looping operations to be run on feature classes and these operations must process hundreds of thousands of points in a few seconds. Because of this we decided it might be worth looking into using a Managed C++/CLI proxy class as explained at the end of this page: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000000wm000000 Apparently it can decrease runtimes on repetive operations quite substantially since in C++ you can skip the interop layer between .NET and COM.I can load my C++/CLI into my C# app fine and access the public methods and what not, but what I can't seem to do is pass any sort of meaningful data between the two. To better illustrate here is some code:C++ ProxyClass
// ProxyClass.h
#pragma once
#include <comdef.h>
#include <comutil.h>
using namespace System;
using namespace System::Runtime::InteropServices;
namespace ArcProxy {
public ref class ArcProxy
{
public:
ArcProxy()
{
::CoInitializeEx(NULL, COINIT_MULTITHREADED);
//ESRI_SET_VERSION(esriArcGISEngine);
}
~ArcProxy()
{
::CoUninitialize();
}
void PointOperations(IFeatureClass % ipPointFeatures, long numPoints)
{
IFeatureCursor *cur;
VARIANT v;
//IFeatureClass* fc = (IFeatureClass *)ipPointFeatures;
//fc->GetFeatures(v, true, &cur);
ipPointFeatures.GetFeatures(v, true, &cur);
//return ipPointFeatures;
}
int test() { return 2;}
};
}
Snippet from the C# app (sourceFeatureClass is an IFeatureClass)
ArcProxy.ArcProxy proxy = new ArcProxy.ArcProxy();
unsafe
{
proxy.PointOperations(ref sourceFeatureClass, 100000);
}
I've tried to mess with a few different approaches after some goggling like using the Marshal class and IntPtr but I can't seem to get it working. C++/CLI dll compiles fine but the C# complains that Error 1 The best overloaded method match for 'ArcProxy.ArcProxy.PointOperations(ref IFeatureClass, int)' has some invalid arguments Error 2 Argument '1': cannot convert from 'ESRI.ArcGIS.Geodatabase.IFeatureClass' to 'ref IFeatureClass' Has anyone successfully implemented a C++/CLI proxy class in their application? Or if anyone can provide any insight I would very much appreciate it.