a question about c#, vb and vc.net

W

www.brook

I have a class defined in C#, which read the data into the memory

//c# code
public class ModelDataIO
{
public: Double [] m_data;
}

I have a c++ code which process the data
public __gc class Model
{
public: bool train(Double *pData, int nSize);
}

Then I call the code in vb
dim mod as Model
dim mio as ModelDataIO
'load the data in....
mod.train(mio.m_data(0), mio.m_data.Length)

It compiles ok, but incurs a run time error,
"System.NullReferenceException"
It is clear that passing mio.m_data(0), is not correct, but It will be
correct for an array declared in vb

eg: dim a(100) as Double
mod.tran(a(0),100) will be correct.

Can anyone tell me how to fix the problem?

Thanks in advance
 

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