Integer list between objects does not work under Windows but works under OS X
Hello, I am facing a really weird problem. I am writing Max externals both for Mac and Win platforms, and my external which works perfectly under Mac OS does not work as expected under Windows.
I have two externals, one sending a int list, the second one receiving the int list.
On sender side, I create the outlet like this in the new() method:
x->HDOutlet=listout(x)
I send the int list like this:
atom_setlong(argv, 1);
atom_setlong(argv+1, 2);
outlet_list(x->HDOutlet, 0L, 2, &argv[0]);
If I put a print object on the outlet, I see this (as expected) on Max window
hdtest 1 2
On receiver side, I have created the inlet like this
class_addmethod (c, (method)hd_test_hdlist, "int", A_GIMME, 0);
and the hd_test_hdlist method is defined like this :
void hd_test_hdlist (t_hd_test *x, t_symbol* s, long argc, t_atom* argv);
Here is my problem : when I check argc on OS X, it equals 2 (which is correct), but on Windows I get 0... The code of my external is exactly the same on Windows and Mac, so I have no idea why I get this behaviour.
Any idea of what could explain that ?
Thank you by advance
Benoit
I just made a quick test : I put a message on my patch, containing two long (so I have a message like (1 2) on my patch
I connected this message to the receiver inlet, and I get the same result as with my sender. So I suppose that the problem comes from the inlet declaration.
Is my method to receive a list of long on default inlet is correct ?
Thanks for your help
Benoit
You have to declare the method to receive lists as follows:
class_addmethod (c, (method)hd_test_hdlist, "list", A_GIMME, 0);
The rest of your code seems correct.
- Luigi
Hello Luigi,
thank you for your help, this solved my problem.
This is a bit funny to see that OS X version of Max interprets correctly a list of long on the inlet, when the listener is configured as "int".. I was starting to get crazy with that.
Benoit
Hello Vanille,
I was just pointing out that Mac version was behaving differently than Win version (it's strange, since the underlying code is normally the same in Max)
Anyway, with a crap declaration like I did, anything can happen...
Benoit