LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DSSetHandleSize

Why do I receive an memory.cpp error when executing the LabVIEW.vi. Second, could you direct me to an example stdcall for using argv and argc within a dll. Thanks in advance for your direction. Connie

/* Call Library source file */

#include "extcode.h"
#include "gmsec_c.h"

#include
#include

#define words 10

_declspec (dllexport) long Lgmpub(char ArrayArgv[], LStrHandle LData);

_declspec (dllexport) long Lgmpub(char ArrayArgv[], LStrHandle LData)
{
MgErr error;
char *seperator={" "};
char *p='\0';
char *token='\0';
char *sarr[words];
int i=0;
int len=-1;
int ldatasize=0;
char teststring[]={"AABBCCDDEEFFGGHHIIJJKKLLMM"};

int size=sizeof(teststring);

/* prepare a char *argv[] type array from labview string */
token=strtok(ArrayArgv, seperator);
len++;
while (token!=NULL)
{
sarr[i]=token;
i++; len++;
token=strtok(NULL, seperator);
}


/* sprintf(ArrayArgv, "%s %d", "This test: ", len); /* do not use string functions with pointers
i.e., sprintf append to labview memory */

error = DSSetHandleSize(LData, sizeof(int32) + size * sizeof(uChar));

if (error != mFullErr && error != mZoneErr){

for (i=0; i (*LData)->str[i]=teststring[i];
}
}


return(0);
}
0 Kudos
Message 1 of 3
(3,521 Views)
I was able to overcome the error message by revising the initialization of teststring:

char teststring[30]={"AABBCCDDEEFFGGHHIIJJKKLLMM"};


I test LData via stringlength after the return and the size of the of LData has not
changed from the initialized length?

I do not appear to reduce the amount of memory I am initializing in LabVIEW and provided to the
Code Function Node.
0 Kudos
Message 2 of 3
(3,518 Views)

Hi Tutor,

 

This looks like you are using LabVIEW to interface to GMSEC (the nasa sponsored publish-subscribe protocol/architecture)-- 

http://gmsec.gsfc.nasa.gov/

 

I am trying to do that as well.  Do you have any information on this?

 

Joji
0 Kudos
Message 3 of 3
(3,246 Views)