En/na Luca Olivetti ha escrit:

Maybe it's not a good idea to mix c multithreaded libraries and pascal code? Any special unit I should use? (I already tried cmem and it made no difference). If I cannot solve it I think I'll have to write a small backend program in c that communicates with pascal either through stdin/stdout redirection or with a socket.

Well, I actually did that and it works pretty well: I hacked the existing linphonec console program to output status codes on stdout, I spawn it using a TProcess to read its input and sending it commands. Everything else in my program is pretty much the same (where before I called a linphone routine, now I write to the TProcess input, where before I gathered status information from a callback[*] now I read from the TProcess output), so I think there's no glaring error in the logic of my program, just something "strange" mixing pascal and c code (note that I'm still using libusb with no apparent issues). I'd really like to debug the original problem, since the current workaround is too hackish to be published, but, alas, every effort to debug it so far has failed.

[*]note that the callbacks were not called at random, but only during a specific call to the linphone library, so there are no synchronization differences between the library calls and the TProcess polling.

Bye
--
Luca

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to