Integer list between objects does not work under Windows but works under OS X

Aug 13, 2011 at 7:18pm

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

#58407
Aug 13, 2011 at 7:54pm

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

#209933
Aug 13, 2011 at 9:38pm

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

#209934
Aug 14, 2011 at 5:04am

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

#209935
Aug 14, 2011 at 5:33am

Hello,

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” …

perhaps because your “int” method was not correct too, as it is supposed to get A_LONG ;-)

class_addmethod (c, (method)myobject_int, "int", A_LONG, 0);
#209936
Aug 14, 2011 at 12:50pm

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

#209937

You must be logged in to reply to this topic.