Qt library and use QLocalServer
-
Hi there this situation
I wrote on Qt library which should connected to Client, decided to use to connect QLocalServer and QLocalSocket,
but faced with the fact that QLocalServer need QApplication, I tried to create a new thread, but to no avail.
now I have no idea how to implement maybe someone knows a solution? -
Hi,
Something's not clear: should your library be usable with non Qt application ?
What OS/Qt version are you using ?
-
blender API Python <> my Qt library <> Qt Aplication
blender load my library through ctypes, a library is to communicate with the main program, the connectivity must work on Windows, Linux, Mac.
sample used for http://developer.nokia.com/community/wiki/Qt_IPC_using_QLocalSocket_&_QLocalServerused Qt 5.3.2
when sent from the library in the program everything is fine, and Feedback not, because The libraries can not handle QLocalServer because there is no loop events.
thanks for the help.
-
I solved the problem)) for example took article http://qtsimple.blogspot.com/2013/10/dll-noqt.html
using
@#include <pthread.h>void * thread1(void * arg)
{
QCoreApplication * app = NULL;
int argc = 0;
app = new QCoreApplication(argc, NULL);ConLib * loadLib = new ConLib(); app->exec();
}
void loadLibrary()
{
pthread_t tid1;int t_arg = 5; int err; err = pthread_create( &tid1, NULL, &thread1, &t_arg); if (err != 0) printf("\ncan't create thread :[%s]", strerror(err)); else printf("\n Thread created successfully\n");
}@
Thank you all for your help.
-
Sorry, I've lost track of this thread.
One thing that puzzles me, you have a memory leak since you instantiate loadLib but never delete it.