[Qt-interest] problem when wrapping a qt dll for using with .NET

Luigi Casalegno lclclc at tin.it
Wed Aug 4 20:41:32 CEST 2010


I am trying to build a wrapper around a qt dll that uses QLocalSocket

When I call the constructor that contains the creation of the instance of
the QLocalSocket (see code below)

The following error is shown



 

Code

 

In the main program (.NET C#)

        public Form1()

        {

            InitializeComponent();

            ar = new ArrTest();

         pc = new PVSSClient();

            worker = new netWorker();

            worker.statusStringChanged += new
netWorker.statusStringChangedEventHandler(this.onStatusStringChanged);

            dStatus.Text = "Idle";

 

        }

 

In the wrapper (C++)

 

PVSSClient::PVSSClient()

{

    netWrapperObject = new CTcomClient();

}

 

In the Qt class

 

CTcomClient::CTcomClient(QObject * parent,PVSSApp * app)

    : QObject(parent)

{

 

    socket = new QLocalSocket(this); /// this line produces the exception

    connect(socket, SIGNAL(error(QLocalSocket::LocalSocketError)),

            this, SLOT(displayError(QLocalSocket::LocalSocketError)));

      application=app;

      

      if (connected=socket->state()==QLocalSocket::UnconnectedState)

      {

            QString serverName=QLatin1String("CTcomServer");

            socket->connectToServer(serverName);

            connected=socket->state()==QLocalSocket::ConnectedState;

            if (connected)

            {

            if (checkConnection(socket))

                  {

                        startupMutex.lock();

                        asyncClient.setServer(serverName);

                        asyncClient.setClient(this);

                        asyncClient.start();

                        startupDone.wait(&startupMutex);

                        startupMutex.unlock();

                  }

                  else

                  {

                        // show connection error

                        QLocalSocket::LocalSocketError err;

                        err=socket->error();

                        displayError(err);

                  }

            }

      }

}

 

Thanks

Luigi Casalegno

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100804/e3becc83/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 16963 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100804/e3becc83/attachment.png 


More information about the Qt-interest-old mailing list