Saturday, April 28, 2007

LabView<->MFC multithreaded bug :(

I can't seem integrate my already foolproof singlethreaded DLL into LabView as a CLF(Call Library Function) , i.e. "foreign helper DLL". It always crashed upon calling MFC's AfxBeginThread(..) function. I hope I can make a tute once I got it working. Really nuts on this, after all night long trying to figure out the solution
Post a Comment

2 comments:

Darmawan Salihun said...

I've got it working after moving AfxBeginThread() to another function within the library. It seems to be you can't create a thread within the InitInstance() virtual function because this function initializes something related to thread within the application as well.

Anyway, another issue that currently works but with a workaround is the termination of the printing thread. I'm using "event" as the synchronization object to terminate the thread because WaitForSingleObject() is somehow never worked as I expected :(

Darmawan Salihun said...

Mind you that the function that creates the new thread (printing thread) is called after InitInstance() finishes its execution.