I must admit my C skills are not quite as sharp as they used to
be. I am creating a PowerBasic DLL that is to be called by a
toolkit written in C. Of course, the development information is
in C as well. Here is what I'm trying to convert:
//This is the structure that will be used.
typedef struct
{
char *module_name;
char *func_name;
char *c_func_name;
}CAPIINFO;
//This is an example of data being filled in the structure
CAPIINFO c_api_info[] = {
{"WSOCK32.DLL", "socket(INT, INT, INT)", "cSocket"},
{NULL,NULL,NULL} };
This is the skeleton of the function that I have to export,
and that the 'C' library is trying to call. I think it is
supposed to return a pointer to the structure.
CAPIINFO *GetCAPIINFO()
{ return &c_api_info[0]; }
I've tried creating a structure, and passing the pointer as the
return value. That along with many other things. The toolkit
keeps telling me that invalid data is being returned. I guess
I would like to know exactly what PB code should be generated
that would be equivalent to the above C. Any help would be
greatly appreciated.
------------------
be. I am creating a PowerBasic DLL that is to be called by a
toolkit written in C. Of course, the development information is
in C as well. Here is what I'm trying to convert:
//This is the structure that will be used.
typedef struct
{
char *module_name;
char *func_name;
char *c_func_name;
}CAPIINFO;
//This is an example of data being filled in the structure
CAPIINFO c_api_info[] = {
{"WSOCK32.DLL", "socket(INT, INT, INT)", "cSocket"},
{NULL,NULL,NULL} };
This is the skeleton of the function that I have to export,
and that the 'C' library is trying to call. I think it is
supposed to return a pointer to the structure.
CAPIINFO *GetCAPIINFO()
{ return &c_api_info[0]; }
I've tried creating a structure, and passing the pointer as the
return value. That along with many other things. The toolkit
keeps telling me that invalid data is being returned. I guess
I would like to know exactly what PB code should be generated
that would be equivalent to the above C. Any help would be
greatly appreciated.
------------------
Comment