I am calling two C++ functions from C#. While doing that in a iteration for around 1 million call i am seeing a overhead of about 30%.
C++ function :
EXTERN_C void STDAPICALLTYPE FunctionA(UINT_PTR mathId)
{
...
...
}
In my C# assembly dll as :
[DllImport("CPlusPlus.dll")]
public static extern void FunctionA([In] IntPtr mathID);
Called from function as below:
public static void HelpingFunction([In]UInt64 mathID)
{
FunctionA((IntPtr)mathID);
}
This way of implementation is creating more overhead when the "HelpingFunction" is called more than a million times.
Can someone give me other ideas so that the overhead can be reduced? What are the other ways to call a C++ function from a C# assembly?
FunctionA
. – Fruiter