Hi, I am having problems calling a function I have written in C from a
DLL.
System is Labview 6.02 on NT4 and MS developer studio 97.
The function prototype in the Call Library Function configuration
looks like this: void binary(unsigned long value, CStr string);
and the code in the c source file looks like this:
------------------------------------------------------
#include "extcode.h"
_declspec(dllexport) void binary(unsigned long value, CStr string);
_declspec(dllexport) void binary(unsigned long value, CStr string)
{
unsigned long mask;
int i = 0;
for (mask = 0x80000000; mask!= 0; i++)
{ if (i == 8||i==17||i==26)
string[i++] = ' ';
string[i] = (mask & value)? '1': '0';
mask=mask>>1;
}
string
[i] = '\0';
}
------------------------------------------------------
I wire a U32 numeric and empty string to the input of the Call Lib
function block, and a string indicator on the output.
When I run the VI I get an error saying the memory could not be
written and I have to terminate labview.
As you can see the function modifies the string passed to it, so I
would like to be able to see that string back in labview.
Anyone got any ideas?
Thanks in advance,
Joe