The following code will not run properly.
C++ codes:
// mytest.cpp
#include "stdafx.h"
#include <string.h>
#include <stdio.h>
extern "C"{
_declspec(dllexport) void _setv(char ***s, int row, int column){
for (int i = 0; i < row;i++){
for (int j = 0; j < column;j++)
{
strcat(s[i][j],"The value in here.");
}
}
}
}
C# codes:
class Program
{
[DllImport("mytest.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void _setv(string[,] s, int row, int column);
static void Main(string[] args)
{
string[,] _arr = new string[2, 2]{{"",""},{"",""}};
_setv(_arr, 2, 2);
}
}
Thank.