[Stuck] Porting the Phidgets object suite to Max 6

    Feb 02 2014 | 9:49 pm
    Dear All,
    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.
    Kind regards, --Aadjan

    • Feb 03 2014 | 12:05 am
      Hi there,
      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.
      - Luigi
    • Feb 03 2014 | 6:20 pm
      Hi Luigi,
      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!
      Kind regards, --Aadjan
    • Feb 04 2014 | 12:23 am
      Hi Aadjan,
      please, load this external in Max 6 and tell me if it now works on your platform. Thanks.
      - Luigi
    • Feb 04 2014 | 8:31 pm
      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.
      Kind regards, --Aadjan
    • Feb 04 2014 | 11:27 pm
      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. Best
      - Luigi
    • Feb 06 2014 | 7:28 pm
      Hi Luigi,
      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.
      Still digging' --Aadjan
    • Apr 14 2014 | 2:21 pm
      The libraries have been updated, you can find the Phidgets objects working with Max6.
    • Apr 14 2014 | 2:21 pm
      The libraries have been updated, you can find the Phidgets objects working with Max6.https://cycling74.com/tools/phidgets-libraries-and-drivers/