Posted: Sun Aug 19, 2001 4:46 am
Restored from previous forum. Originally posted by wayne1.
I have no problem returning numeric variables to a pure library function in C
but a can't get a string variable to return obviously I'm coding wrong but I can't figure out what. My Pure Library .desc file is correct
Below is three test functions that are working C code but will not work as a
pure library. Any help would be appreciated.
#define PURELIBRARY
#include
#include
#include
#ifdef PURELIBRARY
extern HINSTANCE PB_Instance;
#else
HINSTANCE PB_Instance;
#endif
extern char* _stdcall PB_ReturnParam1(char source[])
{
//MessageBox(0,source,"",0);
return source;
}
extern char* _stdcall PB_ReturnParam2(char *source)
{
//MessageBox(0,source,"",0);
return source;
}
extern char* _stdcall PB_ReturnString()
{
char *returnString;
returnString="Return Value Test";
return returnString;
}
#ifndef PURELIBRARY
int main()
{
char *string;
char *stringNo2;
string=PB_ReturnParam1("Testing ReturnParam1()");
MessageBox(0,string,"",0);
string=PB_ReturnParam2("Testing ReturnParam2()");
MessageBox(0,string,"",0);
stringNo2=PB_ReturnString();
MessageBox(0,stringNo2,"",0);
return 0;
}
#endif
I have no problem returning numeric variables to a pure library function in C
but a can't get a string variable to return obviously I'm coding wrong but I can't figure out what. My Pure Library .desc file is correct
Below is three test functions that are working C code but will not work as a
pure library. Any help would be appreciated.
#define PURELIBRARY
#include
#include
#include
#ifdef PURELIBRARY
extern HINSTANCE PB_Instance;
#else
HINSTANCE PB_Instance;
#endif
extern char* _stdcall PB_ReturnParam1(char source[])
{
//MessageBox(0,source,"",0);
return source;
}
extern char* _stdcall PB_ReturnParam2(char *source)
{
//MessageBox(0,source,"",0);
return source;
}
extern char* _stdcall PB_ReturnString()
{
char *returnString;
returnString="Return Value Test";
return returnString;
}
#ifndef PURELIBRARY
int main()
{
char *string;
char *stringNo2;
string=PB_ReturnParam1("Testing ReturnParam1()");
MessageBox(0,string,"",0);
string=PB_ReturnParam2("Testing ReturnParam2()");
MessageBox(0,string,"",0);
stringNo2=PB_ReturnString();
MessageBox(0,stringNo2,"",0);
return 0;
}
#endif