Problems running with default code

C, C++, and Visual C++
wantphidgettowork

Problems running with default code

Postby wantphidgettowork » Sat Aug 29, 2009 9:33 pm

Hi everyone, here is my problem.

I am running Vista x64 Business. I am using Codeblocks IDE with gcc/g++ mingw compiler. I have installed the x64 .msi of phidgets21. Now the taskbar program that comes with the install works fine. You can detect the phidget and open it up and see the keys as it reads tags. Now, when I try to compile the RFID-simple code, it works fine(disregarding the fact I had to remove all the deprecated statments in the phidgets21.h). Now one thing interesting is that on compilation, I always get "warning: passing arg1 of 'CPhidgetsRFID_set_OnTag_hander' from incompatible pointer type. That warning shows up on 6 things actually, all of which are event handlers. If trying to compile that same code with g++ for a C++ file, they turn into errors and can not run. Back to the C compile. When I run everything seems to be fine, until you let the reader read a tag. Once the event handler for the tag is activated, it executes. It execute fine too, it displays the tag ID and all. However, when the handler returns from the function, the program crashes and windows closes the program. I have tried everything I can think of to get away from the handler crashing but to no avail. When I debug the program with gdb, I to see an interesting printout that says that the .dll files are not found. However I have included the .dll's not only in the system dir, but also the install directory and the directory where I am running the program. After the debugger shows those lines, it runs fine untill a tag is read and a segfault is returned. Anyone know of any possible causes for this issue or any direction to point me in. Thanks in advance!

User avatar
Patrick
Lead Developer
Posts: 3098
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Problems running with default code

Postby Patrick » Mon Aug 31, 2009 9:45 am

You're sure that your events handler functions have the right signature? What int do you return? The reason gdb can't find the dll is probably because phidget21.dll doesn't have debug symbols included.

-Patrick

User avatar
Patrick
Lead Developer
Posts: 3098
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Problems running with default code

Postby Patrick » Mon Aug 31, 2009 9:53 am

Another thing to note is that on Windows, you need to make sure your callback handlers are using the __stdcall calling convention - I'm not sure how you do this for MinGW, but that's probably why the function pointers don't match.

-Patrick


Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 2 guests