Mam funkcję z biblioteki:
int __stdcall _DGTDLL_RegisterScanFunc (int __stdcall (*scanfunc) (char*));
Próbuje ją otworzyć w C# (LoadLibrary, GetProcAddress, delegate...). Teraz chodzi tutaj o ten parametr. W jaki sposób to obłużyć
Dla przykłady bezparametrową funkcję z tej biblioteki wywołuje bez problemu.
int __stdcall _DGTDLL_GetVersion();
Kolejna część problemu. Mam opis funkcji RegisterScanFunc:
Description: use this to let the DLL know which function to call when it fires a scan event.
Do tego dochodzi problem, jako że ta funkcja przyjmuję jako parametr funkcję która ma się wywołać i w przykładzie z dokumentacji mam:
// now the DLL is properly loaded and initialized
if (registerScanFunc!=nullptr) {
registerScanFunc(&myScanCallback);
// From now on, myScanCallback is called when new scans come in
}
///////////// register other callback functions
///////////// your stuff here, keep in mind that you still need an event loop
I pytanie jak powinno w .net wyglądać event loop.
Nie bardzo wiem jak to opisywać, ale jak coś to pytajcie.