How to use the topic orb_advertise_multi function

I advertise a topic with two instant as followed:
int idx1,idx2;

pub1 = orb_advertise_multi(ORB_ID(xxx_status),&xxx_status,&idx1,ORB_PRIO_DEFAULT);
pub2 = orb_advertise_multi(ORB_ID(xxx_status),&xxx_status,&idx2,ORB_PRIO_DEFAULT);

but when I debug it,I found the idx1 and idx2 all equal 0.
whether I use it with error way?

Hi
Your code looks correct and the following:

int inst1, inst2;
orb_advertise_multi(ORB_ID(vehicle_command), &cmd, &inst1, ORB_PRIO_DEFAULT);
orb_advertise_multi(ORB_ID(vehicle_command), &cmd, &inst2, ORB_PRIO_DEFAULT);
PX4_WARN("%i %i", inst1, inst2);

works for me and outputs 0, 1. You need to provide more context for us to be able to help.