Hi, I need to call a C++ API from C#. I have been able to call the API, but the char[] parameters do not seem to be marshalling correctly. Here's the C++ signature:
Create2ptModel(double modelPowers[2],
double modelDacs[2],
int pclRange[2],
double targetPowers[32],
double *dacAdjustFactor,
unsigned short powerRampFactors[32],
BOOL bPCLDacAdjusted[32],
char calibrationModel[32],
char errMsg[1024])
and this is how I am trying to call it from C#
[DllImport("AlgorithmsLib.dll", EntryPoint = "_Create2ptModel@36",
ExactSpelling = true, CallingConvention = CallingConvention.StdCall,
CharSet = CharSet.Auto)]
private static extern AlgorithmStatus Create2ptModel(
double[] modelPowers,
double[] modelDacs,
int[] pclRange,
double[] targetPowers,
ref double dacAdjustFactor,
ushort[] powerRampFactors,
bool[] bPCLDacAdjusted,
/**/char[] calibrationModel,
char[] errMsg/**/);
Any idea of how I can marshall it correctly? Thanks in advance!