【发布时间】:2011-10-21 10:35:46
【问题描述】:
C++ dll 函数声明是
static void __clrcall BubbleSort(int* arrayToSort,int size);
我的 C++ dll 函数是
void Sort::BubbleSort(int* sortarray,int size)
{
int i,j;
int temp=0;
for(i=0; i< (size - 1); ++i)
{
for(j = i + 1; j > 0; --j)
{
if(sortarray[j] < sortarray[j-1])
{
temp = sortarray[j];
sortarray[j] = sortarray[j - 1];
sortarray[j - 1] = temp;
}
}
}
}
在 C# 中,我将上述函数作为
Sort.Sort.BubbleSort(arrayToBeSort,5);
但 C 语言编译器会报错
'Sort.Sort.BubbleSort(int*, int)' 的最佳重载方法匹配有一些无效参数 和 论点 1:无法从 'int[]' 转换为 'int*'
【问题讨论】:
-
C#代码中
Sort.Sort.BubbleSort是如何声明的 -
第一次排序是命名空间第二次排序是一个类名
-
如果你需要帮助你需要显示
BubbleSort的C#声明。 -
冒泡排序的 C# 声明private void BtnSubmitClick(object sender, EventArgs e) { Sort.Sort.BubbleSort(arrayToBeSort,5); for (int i = 0; i
-
不,这就是你所说的。您还没有出示您的声明。
标签: c# c++ visual-c++