Hi!
I am trying to update an old data base application created earlier with VB3 and RDM45.dll. There is a data base definition routine which creates a C language header file which include the following definition
struct vets_r {
short vetno;
char vetnimi[30];
char prof[30];
char erik[30];
} VETS;
Today there is an updated RDM7.dll which has been created with unmanaged C++.
The database accessing functions can be transferred to managed CLI C++ code with
[DllImport("rdm7.dll", EntryPoint = "d_recread", CharSet = CharSet::Ansi, CallingConvention=CallingConvention::StdCall)]
extern "C" int d_recread(void*, void *, int);
For the data I have tried to use
[StructLayout( LayoutKind::Sequential )]
ref class mVETS
{
public:
static int mvetno;
static String^ mvetnimi;
static String^ mprof;
static String^ merik;
};
All called database functions perform correctly and return correct status messages, but when I try to read the old data base with definitions
mVETS^ pvet = gcnew mVETS();
d_recread(&pvet, Currtask, CURR_DB)
the routine performs without difficulties as many times as there are items in the old data base but - for instance with
pvet->mvetnimi
I receive no data. Can anyone tell me what is wrong.
Also, for the item vetno which is originally a 2-byte signed integer I have tried to use the conversion
[MarshalAs(UnmanagedType::I2)]
but no matter where in the code I try to implement it, errors are created.
Can anyone help me how to do it correctly.
I am trying to update an old data base application created earlier with VB3 and RDM45.dll. There is a data base definition routine which creates a C language header file which include the following definition
struct vets_r {
short vetno;
char vetnimi[30];
char prof[30];
char erik[30];
} VETS;
Today there is an updated RDM7.dll which has been created with unmanaged C++.
The database accessing functions can be transferred to managed CLI C++ code with
[DllImport("rdm7.dll", EntryPoint = "d_recread", CharSet = CharSet::Ansi, CallingConvention=CallingConvention::StdCall)]
extern "C" int d_recread(void*, void *, int);
For the data I have tried to use
[StructLayout( LayoutKind::Sequential )]
ref class mVETS
{
public:
static int mvetno;
static String^ mvetnimi;
static String^ mprof;
static String^ merik;
};
All called database functions perform correctly and return correct status messages, but when I try to read the old data base with definitions
mVETS^ pvet = gcnew mVETS();
d_recread(&pvet, Currtask, CURR_DB)
the routine performs without difficulties as many times as there are items in the old data base but - for instance with
pvet->mvetnimi
I receive no data. Can anyone tell me what is wrong.
Also, for the item vetno which is originally a 2-byte signed integer I have tried to use the conversion
[MarshalAs(UnmanagedType::I2)]
but no matter where in the code I try to implement it, errors are created.
Can anyone help me how to do it correctly.