hi.
My program included :
+ libsock.c
+ demo_use.c
+ Makefile
i build libsock.c as shared library named libmylibra.so ( support my_send() function )
demo_use.c use my_send() and built with -lmylibra option
Thanks for any advise.
Luan Dinh
PS :i also attach the source code of these files
######### libsock. c###
void demo(void *agr)
{   
    int len,i;
    rt_task_set_periodic(NULL, TM_NOW, 100000000);
    while (1) {      
    rt_task_wait_period(NULL);
    len = send(sock, data, sizeof(data), 0);
        if (len < 0)
    {
        printf("Sent Failed...!\n");
            break;
    }   
    }      
}
/*my_send*/
int my_send()
{   
    struct sched_param param;// = { .sched_priority = 1 };     
      struct sockaddr_ll addr;
      struct ifreq ifr;   
    mlockall(MCL_CURRENT|MCL_FUTURE);   
    if ((sock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL))) < 0) {
            perror("socket cannot be created");
            return 1;
    }
    strncpy(ifr.ifr_name, "rteth0", IFNAMSIZ);
    if (ioctl(sock, SIOCGIFINDEX, &ifr) < 0) {
            perror("cannot get interface index");
            close(sock);
            return 1;
       }
     addr.sll_family   = AF_PACKET;
        addr.sll_protocol = htons(ETH_P_ALL);
    addr.sll_pkttype  = PACKET_OTHERHOST;
        addr.sll_ifindex  = ifr.ifr_ifindex;

        if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
            perror("cannot bind");
            close(sock);
            return 1;
        }
   
    rt_task_create(&demo_task, "mytask", 0, 99, 0);
    rt_task_start(&demo_task, &demo, NULL);     
    return 1;
}

### demo_use.c ###
int main( int argc, char * argv[] )
{
    my_send();
    pause();   
    return 1;   
}

## Makefile ###
CC = gcc
AR = ar cru
SOFLAGS = -shared -Wl
CFLAGS = -I/usr/xenomai/include -I/usr/xenomai/include/posix -D_GNU_SOURCE -D_REENTRANT -D__XENO__ -Wall -g -fPIC -rdynamic -pipe -O2 -fstrict-aliasing
LDFLAGS = -Wl,@/usr/xenomai/lib/posix.wrappers -L/usr/xenomai/lib -lpthread_rt -lpthread -lnative -lrt -lstdc++ -ldl
LINKER = $(CC)
LINT = lint -c
RM = /bin/rm -f
LIBOBJS =  libsock.o
TARGET =  libmylibra.so \
        test
all: $(TARGET)
libmylibra.so: $(LIBOBJS)
    $(LINKER) $(SOFLAGS) -o $@ $^ -lc
test: demo_use.o
    $(LINKER) $(LDFLAGS) $^ -L. -lmylibra -o $@
clean:
    @( $(RM) *.o vgcore.* core core.* $(TARGET) )
# make rule
%.o : %.cpp
    $(CC) $(CFLAGS) -c $^ -o $@   

Please post an excerpt of your code exposing this issue (the library
part, and the program part).

You should note that compiling libraries or programs for Xenomai usually
involves compilation flags obtained with xeno-config.

You should also note that "send()" is a glibc function, so calling a
function with the same name is a bad idea.

--
                                                 Gilles.