[Stuck] Porting the Phidgets object suite to Max 6
First the backstory:
I am working to support the Phidget hardware (sensors and actuators) in Max on Windows 64bit. The company has always provided excellent support for their products in Max but the last year they could not give priority to provide a modern Max 6 suite of objects (maybe I was the only one harassing them). They were willing to share the code of the old objects.
To get the project going I started on MacOS 10.9 with Xcode 5.0.2 and the Max SDK 6.1.4. The dummy object in the SDK to compiles and I can debug the external just fine. So I went ahead and modified the Phidget object code to accommodate the new style initialization routine (it was still using setup). The new code compiles and pronto a fresh new external is delivered.
Now the problem:
When I instantiate the object in Max it does not work (the object shows but no inlets/outlets and the color is that of an unrecognized object – no error message in the Max window though). When I debug the code the debugger nicely lands in the main() function and a good (it looks good to me…) t_class can be seen at the end of main(). However, the new instance routine is never called and the strange thing is that the main() is called 3 times. After which the object box shows with the same behaviour as described above.
I have been trying to get past this for the last couple of days, carefully checking the code and even taking some time off to come at it with a fresh perspective. This post is another attempt along that line.
Please share any thoughts you might have.
it could be dependent on the source code or the way your Xcode project is setup.
In any case it is really difficult to provide some help unless you are willing to share the Xcode project along with the source code of the object in question.
Would indeed appreciate if you can take a look. Find the source with this message and a zip with the working Xcode project at the following link: https://dl.dropboxusercontent.com/u/1745173/PhidgetsMaxSource.zip
Looking forward to some insights!
Many thanks Luigi!
I can now see a valid Max object with an inlet and outlet. Obviously you have pushed it past the obstacle I was running into. Still not the proper response to messages but I can probably deal with that (maybe overly confident ;-).
How did you do it? I would like to reproduce it in code so I can learn and continue on.
Yes, of course. I just wanted to know if my solution worked for you too…
It was a problem in the code. Here is the complete source code with my fixes.
Please notice that there is still a memory leak in the new method.
The leak was in the original code and I didn’t have time to fix it.
In any case, it should be pretty easy for you to do…
Glad I could help.
Sweet success! See the attached screen capture from Windows 8.1 64bit.
Still do not no exactly where I went wrong, couple of differences in the main.c you provided. My old c brain can not figure it out. Went straight ahead with your file to Windows and had to scale back from Visual Studio 2013 to express to successfully compile and build a .mxe64.
The libraries have been updated, you can find the Phidgets objects working with Max6.
The libraries have been updated, you can find the Phidgets objects working with Max6.http://cycling74.com/toolbox/phidgets-libraries-and-drivers/