Managed C++ functions - Problems calling from VB.NET

G

Guest

I've created a managed C++ wrapper dll using Microsoft Visual Studio 200

When I try to call functions in the dll from VB.NET I get an error "System.NullReferenceException
I found that if preceded a simple test function with #pragma unmanaged I can then run the function from VB.NE
However, if I remove the #pragma unmanaged statement then the error comes back
I have functions that I want to pass System.Array types to as inputs so I cannot wrap everything with #pragma unmanage
I have no idea what is causing the problem? I would appreciate any suggestions
The source for my simple test function is belo

#using <mscorlib.dll

//#pragma unmanage
EXTERN_C int __declspec(dllexport) aaTest(

return(0)
}
 
R

Ronald Laeremans [MSFT]

Why don't you make them directly callable from VB.Net:

public __gc class Functions
{
public:
static int aaTest() {return 0};
}

Ronald

Rob said:
I've created a managed C++ wrapper dll using Microsoft Visual Studio 2003

When I try to call functions in the dll from VB.NET I get an error "System.NullReferenceException"
I found that if preceded a simple test function with #pragma unmanaged I
can then run the function from VB.NET
However, if I remove the #pragma unmanaged statement then the error comes back.
I have functions that I want to pass System.Array types to as inputs so I
cannot wrap everything with #pragma unmanaged
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top