Hi,
If instead of using pthread_create I use CreateThread, I never have a problem. I notice no other wine DLLs are using pthread_create and I have seen hints that this might not work. If so, how do I use the Linux library. (Call_dll_to_spawn_thread_and_register_callback is just simulating what the Linux library would do)
There are some problems if Linux libraries create a thread behind the calling application in Wine. I do not know what the problem is precicely, but I think Win32 code can be confused if it is called from a thread that doesn't have the Win32 thread structures that should belong to it. If the library creates a thread, and this thread calls back into the Windows app's code, the code running in the windows application can't find the current thread ID, simply because the Win32 thread information is not there.
There was a problem like this with the CoreAudio library on macos, but I am not sure about the details.
Is there any reason why you cannot use CreateThread?