Le 10/05/2017 à 17:20, Stéphane Ancelot a écrit :

Le 10/05/2017 à 17:06, Henning Schild a écrit :
Hi,

today i have to a question from an application developers point of
view. How do i override the default value of a tunable when libcobalt
is linked with dlopen()?
This article https://xenomai.org/2015/05/application-setup-and-init/
describes the tunables but not the dso-case.
this may help you.
#include <xenomai/init.h>
#include <xenomai/tunables.h>



static int foo_tune(void)
{
        set_config_tunable(mem_pool_size,5000000);
        printf("mem pool size=%ld\n", get_config_tunable(mem_pool_size));


         return 0; /* Success, otherwise -errno */
}

/*
 * CAUTION: we assume that all omitted handlers are zeroed
 * due to the static storage class. Make sure to initialize them
 * explicitly to NULL if the descriptor belongs to the .data
 * section instead.
 */
static struct setup_descriptor foo_setup = {
        .name = "foo",
        .tune = foo_tune,
        .parse_option = NULL,
        .help = NULL,
        .init = NULL,
        .options = NULL,
};

/* Register the setup descriptor. */
user_setup_call(foo_setup);

char  **fakeargv;
int *fakeargc;

#ifdef __COBALT__
    fakeargc = (int*)malloc(sizeof(int));
    *fakeargc =1;
    fakeargv = (char**)malloc(2*sizeof(char*));
    fakeargv[0] = (char*)malloc(7);
    strcpy(fakeargv[0],"python");
    fakeargv[1] = NULL;
    xenomai_init(fakeargc,(char* const**)&fakeargv);
#endif

Is there a way to override the default values when using dlopen()?
Maybe delaying the call to the constructors, or passing some arguments
to them?

kind regards,
Henning

_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai

_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai

_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai

Reply via email to