ive made a dll in c, and it gets called with visual basic.
in vb one of the parameters i pass is the address of a vb function.
i can get the dll to run the function fine, but i need to put that address into a struct to pass into a thread, which is where my problem is.
i have typedef'd the function pointer as
typedef void (*vbFuncEntry)(int);
a simplified version of the dll function header is
__declspec(dllexport) int __stdcall Function(LPTSTR msg, vbFuncEntry vbFE);
inside that function if i do something like
(vbFE)(500);
it calls the vb function no problem.
but when i try to assign that address into a struct, and call it later it doesnt work. im sure it just has to do with the fact that im assigning it wrong.
i have
typedef struct {
char *msgPtr;
vbFuncEntry funcEntry;
} info, *pinfo;
//and later on in the exported dll function
pinfo p2info = HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(info));
p2info->funcEntry = vbFE;
//in the thread when i call
(p2info->funcEntry)(500); //the program crashes
again i just think im doing that pointer assignment wrong, or it needs to be a pointer to a function pointer and i dont know how to do the assignment for it.
thanks for any help :)