Axtroz
8th February 2012, 21:56
Greetings, I've created an external DLL for pinging remote hosts, because Qt doesn't have any ping methods.
I load it with QLibrary the following way:
Header file:
typedef float (*sendPing)(char *ip,int size,int timeout)
...
class MyClass : public QWidget
{
Q_OBJECT
...
sendPing pinger;
and in my CPP file:
...
pinger = (sendPing) QLibrary::resolve("libICMP","libIcmpSendEcho");
...
if (!pinger) { QMessageBox::critical(this, "Error", "Unable to load libIcmpSendEcho function!"); return; }
else { pinger("127.0.0.1",32,100); }
I'm compiling the program and testing under wine and it works fine, but when run the application under Windows with libICMP.dll in the program directory it fails with the QMessage box appearing. I can't see a reason why does it work under wine and not under native windows... Thank you for all replies!
I load it with QLibrary the following way:
Header file:
typedef float (*sendPing)(char *ip,int size,int timeout)
...
class MyClass : public QWidget
{
Q_OBJECT
...
sendPing pinger;
and in my CPP file:
...
pinger = (sendPing) QLibrary::resolve("libICMP","libIcmpSendEcho");
...
if (!pinger) { QMessageBox::critical(this, "Error", "Unable to load libIcmpSendEcho function!"); return; }
else { pinger("127.0.0.1",32,100); }
I'm compiling the program and testing under wine and it works fine, but when run the application under Windows with libICMP.dll in the program directory it fails with the QMessage box appearing. I can't see a reason why does it work under wine and not under native windows... Thank you for all replies!