I am trying to access an API for an eMatrix PDM through a DLL... (mqlio32.dll or mqlvb32.dll)
mqlio32.dll is intended for C++
mqlvb32.dll is intended for (you guessed it) VB
the documentation shows the declarations for a few of the functions as follows:
To get these to work in VB(6) they were declared like this...
So far in C#, I currently have this...
I tried changing the Sting's to char *, but that is unsafe...
So I tried it in an unsafe block, and it still does not work...
Now, part of the DLL does work in C#...
I can open up the interface window with mqlOpen
I can send a command to the interface with mqlInput, which does show up in the interface window.
And then I can recieve whether or not any output is pending with mqlPending
BUT... I can not retrieve the output with mqlOutput...
It returns how many characters were in the Output, but it returns the unmodified buffer string that you passed it... (which consist of about 5000 blank spaces which worked fine in VB and was instructed in the docs...)
Does anyone see anything imediately wrong with my declarations?
if you need more info, please ask... this is driving me crazy...
Have Fun, Be Young... Code BASIC
-Josh
PROGRAMMER:
Red-eyed, mumbling mammal capable of conversing with inanimate objects.
mqlio32.dll is intended for C++
mqlvb32.dll is intended for (you guessed it) VB
the documentation shows the declarations for a few of the functions as follows:
Code:
int mqlOpen(void);
int mqlExecute(MQLBOS_STR_FAR_PTR format);
int mqlOpenLog(char * filename);
int mqlCloseLog(void);
int mqlTimeout(int seconds);
int mqlPending(void);
int mqlErrors(void);
int mqlOutputs(void);
int mqlInput(char * buffer, int size);
int mqlOutput(char * buffer, int limit);
int mqlError(char * buffer, int limit);
int mqlClose(void);
To get these to work in VB(6) they were declared like this...
Code:
Declare Function mqlOpen Lib "mqlvb32.dll" () As Integer
Declare Function mqlExecute Lib "mqlvb32.dll" (ByVal mqlcmd$) As Integer
Declare Function mqlOpenLog Lib "mqlvb32.dll" (ByVal FileName$) As Integer
Declare Function mqlCloseLog Lib "mqlvb32.dll" () As Integer
Declare Function mqlTimeOut Lib "mqlvb32.dll" (ByVal Seconds%) As Integer
Declare Function mqlPending Lib "mqlvb32.dll" () As Integer
Declare Function mqlErrors Lib "mqlvb32.dll" () As Integer
Declare Function mqlOutputs Lib "mqlvb32.dll" () As Integer
Declare Function mqlInput Lib "mqlvb32.dll" (ByVal Buffer$, ByVal Size%) As Integer
Declare Function mqlOutput Lib "mqlvb32.dll" (ByVal Buffer$, ByVal Limit%) As Integer
Declare Function mqlError Lib "mqlvb32.dll" (ByVal Buffer$, ByVal Limit%) As Integer
Declare Function mqlClose Lib "mqlvb32.dll" () As Integer
So far in C#, I currently have this...
Code:
[DllImport("mqlio32.dll")]
private static extern int mqlOpen();
[DllImport("mqlio32.dll")]
private static extern int mqlExecute(String mqlcmd);
[DllImport("mqlio32.dll")]
private static extern int mqlOpenLog(String FileName);
[DllImport("mqlio32.dll")]
private static extern int mqlCloseLog();
[DllImport("mqlio32.dll")]
private static extern int mqlTimeout(int Seconds);
[DllImport("mqlio32.dll")]
private static extern int mqlPending();
[DllImport("mqlio32.dll")]
private static extern int mqlErrors();
[DllImport("mqlio32.dll")]
private static extern int mqlOutputs();
[DllImport("mqlio32.dll")]
private static extern int mqlInput(String Buffer, int Size);
[DllImport("mqlio32.dll")]
private static extern int mqlOutput(String Buffer, int Limit);
[DllImport("mqlio32.dll")]
private static extern int mqlError(String Buffer, int Limit);
[DllImport("mqlio32.dll")]
private static extern int mqlClose();
I tried changing the Sting's to char *, but that is unsafe...
So I tried it in an unsafe block, and it still does not work...
Now, part of the DLL does work in C#...
I can open up the interface window with mqlOpen
I can send a command to the interface with mqlInput, which does show up in the interface window.
And then I can recieve whether or not any output is pending with mqlPending
BUT... I can not retrieve the output with mqlOutput...
It returns how many characters were in the Output, but it returns the unmodified buffer string that you passed it... (which consist of about 5000 blank spaces which worked fine in VB and was instructed in the docs...)
Does anyone see anything imediately wrong with my declarations?
if you need more info, please ask... this is driving me crazy...
Have Fun, Be Young... Code BASIC
-Josh

PROGRAMMER: