Quote:

yes, it's tricky, but there is no easier way.
if there is, please show me.



Show me yours first

From what I remember when I was playing with COM automation, you can determine the data type that is being passed, and convert where necessary.

You should be able to return all the types, cast to longs, doubles and strings.

It doesn't matter a whole lot that in the file it is an unsigned integer, and when it arrives in KiXtart it is a double. When you write "123.45" as a double in the file it doesn't matter that in KiXtart it is a string - you just need to handle the type and convert to the correct form.

I don't know C++, so bear with me while I explain in C.

If you have a function which is receiving a string and needs to write it out as a double there are a couple of ways. Here's one:
Code:
/* Create a simple output file */

#include <stdio.h>

void fnWriteStringAsBYTE(FILE *fp,char *s)
{
char c;
c=(char)atoi(s);
fwrite(&c,sizeof c,1,fp);
}

void fnWriteStringAsINT(FILE *fp,char *s)
{
int i;
i=atoi(s);
fwrite(&i,sizeof i,1,fp);
}

void fnWriteStringAsLONG(FILE *fp,char *s)
{
long l;
l=atol(s);
fwrite(&l,sizeof l,1,fp);
}

void fnWriteStringAsDOUBLE(FILE *fp,char *s)
{
double d;
d=atof(s);
fwrite(&d,sizeof d,1,fp);
}

int main()
{
fnWriteStringAsBYTE(stdout,"123");
fnWriteStringAsINT(stdout,"123");
fnWriteStringAsLONG(stdout,"123456");
fnWriteStringAsDOUBLE(stdout,"1234.56");
return 0;
}



When reading it is even easier.
Load the variable into the correct type, then cast it to the type that you are going to return to KiXtart. The type you return just needs to be big enough to handle the full range of the original type.