G
Guest
I got a DLL that reads some RAW Double Data from a File to an Array
The DLL works fine
This is the Header of the double_read function
int dll_dbl_read (const char * fnam,
/* File name to read from *
int * res,
/* returns int[4]*
float * len,
/* returns float[4]*
double ** data)
/* returns double[unknown size]*
This is how I call the function from C++
char * myfname
int res[4]
float len[4]
double * data
int m_type
int DataStack::dbl_read(const char * fname
m_type = dll_dbl_read(fname,res,len,&data)
myfname = new char[strlen(fname)+1]
strcpy(myfname, fname)
return m_type
This works fine and I would like to know how to call this function from C#????
This is what I try in C# and what doesn´t work
using System
using System.Runtime.InteropServices
namespace min
/// <summary
/// Summary description for FileIO
/// </summary
public unsafe class FileI
public int m_type
public char* myfname
public int * res
public float * len
public double ** data
[DllImport("MYLIB.DLL", EntryPoint="dll_dbl_read", SetLastError=true, CharSet=CharSet.Unicode, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)]
public static unsafe extern int dll_dbl_read(char[] fnam, int* res, float* len, double** data)
public int dbl_read(string fname
int result
int[] resolution = {0,0,0,0}
float[] length = {0,0,0,0}
double[] mydata = {0}
myfname = &fname.ToCharArray()
fixed (int* res = resolution
fixed (float* len = length
fixed (double* data = mydata
result = dll_dbl_read(myfname,res,len,&data)
/*Just for Testing*
int x = res[0]
float xl = len[0]
double test = data[100];
test = data[23]
/*Everything is empty here
(*
return result
public FileIO(
Can Anybody tell me how to Create my Variables to pass to the functio
dll_dbl_read? So that I find my data in there and not only 0 or NULL
Thanks in Advanc
Martin
The DLL works fine
This is the Header of the double_read function
int dll_dbl_read (const char * fnam,
/* File name to read from *
int * res,
/* returns int[4]*
float * len,
/* returns float[4]*
double ** data)
/* returns double[unknown size]*
This is how I call the function from C++
char * myfname
int res[4]
float len[4]
double * data
int m_type
int DataStack::dbl_read(const char * fname
m_type = dll_dbl_read(fname,res,len,&data)
myfname = new char[strlen(fname)+1]
strcpy(myfname, fname)
return m_type
This works fine and I would like to know how to call this function from C#????
This is what I try in C# and what doesn´t work
using System
using System.Runtime.InteropServices
namespace min
/// <summary
/// Summary description for FileIO
/// </summary
public unsafe class FileI
public int m_type
public char* myfname
public int * res
public float * len
public double ** data
[DllImport("MYLIB.DLL", EntryPoint="dll_dbl_read", SetLastError=true, CharSet=CharSet.Unicode, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)]
public static unsafe extern int dll_dbl_read(char[] fnam, int* res, float* len, double** data)
public int dbl_read(string fname
int result
int[] resolution = {0,0,0,0}
float[] length = {0,0,0,0}
double[] mydata = {0}
myfname = &fname.ToCharArray()
fixed (int* res = resolution
fixed (float* len = length
fixed (double* data = mydata
result = dll_dbl_read(myfname,res,len,&data)
/*Just for Testing*
int x = res[0]
float xl = len[0]
double test = data[100];
test = data[23]
/*Everything is empty here

return result
public FileIO(
Can Anybody tell me how to Create my Variables to pass to the functio
dll_dbl_read? So that I find my data in there and not only 0 or NULL
Thanks in Advanc
Martin