Char Pointer from C++ DLL

Joined
Oct 26, 2009
Messages
2
Reaction score
0
I recently converted my application into C# as VS2008 does not support new Data Sources (?!), but now I am stuck on one command from the old DLL.

Here is the old function declaration and command that worked in C++:
Code:
 typedef short(*pfunc2)(short address, LPSTR cmd, short irqnum);
  pfunc2 pfSendAT6400Block	=	(pfunc2)GetProcAddress(hndl, "SendAT6400Block");
 
 char *testCommands[258] = {"A100:V50:D254000:GO1:"}; //Pointer to a null-terminated string 
 SetTimeout(10000);					
  SendAT6400Block(768, *testCommands, 0);

I definitely have the DLL loaded correctly in C# as the other commands work, but I have a feeling my syntax with sending the commands, which would be the LPSTR cmd delcaration. My C# code snippets are below.
Code:
[DllImport("C:\\WINDOWS\\system32\\nt6400.dll", CharSet = CharSet.Auto)]
 public static extern short SendAT6400Block(short address, [MarshalAs(UnmanagedType.LPStr)] string cmd, short irqnum);
 
 string commandSTR = "A100:V50:D254000:G01:";
 NT6400.SetTimeout(2000);
 int SendBlockReturn = NT6400.SendAT6400Block(768, commandSTR, 0);

So now my SendAT6400Block is not working in C# when it was working in my old C++ code. Could anyone provide any insight or do you need some more information?

Your help, as always, is greatly appreciated.
 
Joined
Oct 26, 2009
Messages
2
Reaction score
0
Anyone have any ideas?

I have also tried null terminating the string, but I still get no motion from my movement arm.
 

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