Hello again and welcome to another tale of mystery :)
I, again, am facing problems connecting my D program to the C API
as seen in the callback thread before.
I want to write a callback function that is assigned to a struct
member. The function should write data from members of another
struct to the command line. Please consider my code:
void MyCB(void* pVoid) {
DataInfo_t* userData; //DataInfo_t is a struct
userData = cast(DataInfo_t*) pVoid;
writeln("Value: ", pMsgUserData.Values[i].value.string);
}
Here the DataInfo_t struct has a member Values which itself is a
struct. The programmer of the API called the members of the union
inside the Values struct after simple data types or pointers to
them, specifically
union value {
const char *string;
}
When I try to compile I get the following error:
Error: need 'this' for 'string' of type 'const(char*)'
I'm not quite sure what the error wants to tell me. The way I see
it is that there is some kind of problem with the instance of the
struct and hence the reference to that specific member value does
not work.
Any ideas?