G
Guest
Hi
Hi
I am trying to call a C# function where I pass an argument by argument by
reference.
Here is the C#
using System;
namespace TheCSharpBit
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Class1
{
unsafe public string CSharpFunction(int *myArg)
{
int i;
string s;
i = *myArg;
s = i.ToString() ;
*myArg=5;
return "From CSharpFunction " + s;
}
}
}
Here is a VB code snippet.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim obj As New TheCSharpBit.Class1
Dim i As Integer
i = 3
Label1.Text = obj.CSharpFunction(i)
Console.WriteLine(i)
obj = Nothing
End Sub
Whan I complie I get the following error:
'CSharpFunction' has a return type that is not supported or parameter types
that are not supported.
I know the problem is with the parameter, so how do I pass the address of I
to the C# function CsharpFunction.
Thanks for your help
Chris
Hi
I am trying to call a C# function where I pass an argument by argument by
reference.
Here is the C#
using System;
namespace TheCSharpBit
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Class1
{
unsafe public string CSharpFunction(int *myArg)
{
int i;
string s;
i = *myArg;
s = i.ToString() ;
*myArg=5;
return "From CSharpFunction " + s;
}
}
}
Here is a VB code snippet.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim obj As New TheCSharpBit.Class1
Dim i As Integer
i = 3
Label1.Text = obj.CSharpFunction(i)
Console.WriteLine(i)
obj = Nothing
End Sub
Whan I complie I get the following error:
'CSharpFunction' has a return type that is not supported or parameter types
that are not supported.
I know the problem is with the parameter, so how do I pass the address of I
to the C# function CsharpFunction.
Thanks for your help
Chris