Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
4
Reply
To set the value of a two-dimensional array in c++ dll
Ken H
Mar 19 2015 6:09 AM
1.1k
Reply
Hello friend,
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.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
How to read data from check box in PDF using iTextsharp?
c# how to get two output params from sqlserver