Reinitialization issue - VxWorks

This is a discussion on Reinitialization issue - VxWorks ; Hi, I have the following C program: int C; void test () { C++; printf ("%d\n", C); return; } When I call `test' over and over in the Shell, the value of C is incremented where I would expect to ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Reinitialization issue

  1. Reinitialization issue

    Hi,

    I have the following C program:

    int C;
    void test () {
    C++;
    printf ("%d\n", C);
    return;
    }

    When I call `test' over and over in the Shell, the value of C is incremented
    where I would expect to be reset (which is what happens if you were to
    launch an executable containing this code over and over). How do I reset it
    in a non-programmatic way?

    Regards,
    Manu



  2. Re: Reinitialization issue

    vxWorks is not Linux.
    Calling functions from the shell does cause the function to be reloaded
    or reset.
    If you build your code into a downloadable kernel module, load the
    module with 'ld', and invoke test() from the shell after each load,
    then you'll see the behavior you're expecting.
    Of course, it would be just as easy to do this....

    C=0
    test
    C=0
    test
    .....

    GV


+ Reply to Thread