I am trying to upgrage an old VB3 & RDM4.5 application with fairly big database into VS.net and RMD7.1. As RDM 7.1 has been created with unmanaged C, I have instead of VB made a test program as a VC++ forms application.
Now I can transfer the RDM functions with for instance:
[DllImport("rdm7.dll", EntryPoint = "d_opentask",
CharSet = Ansi)]
extern "C" int d_opentask(void *);
and even the unmanaged structures with:
[StructLayout( LayoutKind::Sequential )]
public __gc class mVETS
{
public:
int mvetno;
String* mvetnimi;
String* mprof;
String* merik;
}
VC++ creates a __gc class FORM1 with an event button1_click. As Windows demands that the designers of the Form are as the first member of the class FORM1, I have created a separate namespace WinSys32 for the above marshalling. Everything works fine with the test routine in button1_click till I try to read some real data from the old (but converted)data base. After that I receive a NullReferenceError and I have no luck either after trying to place a constructor for the data in many different places.
I am sure I can't write or place the constructor correctly and I wonder if someone could help me. I have tried the following contsructor:
mVETS::mVETS( int eno, String *ell, String *amm, String
*spe )
{
mvetno = eno;
mvetnimi = ell;
mprof = amm;
merik = spe;
}
If I put the constructor in the class WinSys32::mVETS and declare the class in Form1 button1_click with
SysWin32::mVETS *pvet = new SysWin32::mVETS;
I get an error message telling that there is no default constructor available.
Thankful for help!
Ilkka Pitkänen
Now I can transfer the RDM functions with for instance:
[DllImport("rdm7.dll", EntryPoint = "d_opentask",
CharSet = Ansi)]
extern "C" int d_opentask(void *);
and even the unmanaged structures with:
[StructLayout( LayoutKind::Sequential )]
public __gc class mVETS
{
public:
int mvetno;
String* mvetnimi;
String* mprof;
String* merik;
}
VC++ creates a __gc class FORM1 with an event button1_click. As Windows demands that the designers of the Form are as the first member of the class FORM1, I have created a separate namespace WinSys32 for the above marshalling. Everything works fine with the test routine in button1_click till I try to read some real data from the old (but converted)data base. After that I receive a NullReferenceError and I have no luck either after trying to place a constructor for the data in many different places.
I am sure I can't write or place the constructor correctly and I wonder if someone could help me. I have tried the following contsructor:
mVETS::mVETS( int eno, String *ell, String *amm, String
*spe )
{
mvetno = eno;
mvetnimi = ell;
mprof = amm;
merik = spe;
}
If I put the constructor in the class WinSys32::mVETS and declare the class in Form1 button1_click with
SysWin32::mVETS *pvet = new SysWin32::mVETS;
I get an error message telling that there is no default constructor available.
Thankful for help!
Ilkka Pitkänen