Hello all,

I'm developing a DLL (in C++) that exports a function which is then called from lite-C. In the minimum working example below the only argument to the function is a pointer back to a lite-C callback function.

Puzzlingly, I get a run time error at the end of main, after all functions have returned. Here's the code:

Code:
//************** TesdDll.dll
#include "stdafx.h"
#include <Windows.h>
typedef void __stdcall callback(void);

extern "C" __declspec(dllexport) void fnTesdDLL(callback* cback){
	MessageBox(NULL, "We're in!", "TestDLL.dll",0);
	(*cback)();
}

//************** main.c
#include <acknex.h>
#include <windows.h>
void __stdcall fnTesdDLL(void*);
#define PRAGMA_API fnTesdDLL;TesdDLL!fnTesdDLL

void __stdcall cbk(){
	MessageBox(NULL, "We're back", "cbk",0);
}

void main(){
	fnTesdDLL(cbk);
	MessageBox(NULL, "We're in main", "main",0);
}



As you can see, I inserted some calls to MessageBox for debugging purposes. All three MessageBox calls are executed, the error surfacing only at the end of main().

The actual error (E1513) reads "Crash in SYS". Before I updated to the latest lite-C version the error read "Crash in cbk". Indeed, the problem seems to have something to do with the return from the callback: if I call fnTesdDLL(cbk) from within a function X then the error will pop at the end of X, not main.

Can anyone help?