Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to pass a one dimensional array vb.net to vc++ managed DLL,in visual studio 2008.Dll is created.In VB.net, During building time it's give one error.

What I have tried:

//ERROR

error BC30657: 'abc' has a return type that is not supported or parameter
type that are not supported .

////////////////////////

//My Dll code // MyCDll.h

#pragma once

using namespace System;
#include "stdafx.h"

namespace MyCDll
{
public ref class Class1
{
public:
static int abc(int nu[])
{
int i,value=0;

for (i=1;i<5;i++)
{
if(nu[i])
{
value=i+1;

}
}
//Return the position of the number in the array.
return value;
}
};
}

The vb.net code:

Imports System.IO
Imports System.Runtime.InteropServices
Module Module1
'Dim result As Integer

Sub Main()
Dim nums() As Integer = New Integer() {1, 2, 3, 4, 5, 6}
'Dim nums() As Integer = {1, 2, 3, 4, 5, 6}
Dim obj As New MyCDll.Class1


Console.WriteLine(obj.abc(ByVal nums() As Integer)As Integer)

'result = obj.abc(ByVal nums()As Integer)

Console.ReadLine()
End Sub

End Module
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900