Weird pointer problem

I have a weird problem with a pointer parameter:

cmdQueuePull(ascii *cmd, viewHdlr view, dictionary_t *viewData);

// Inside some function i have this:
dictionary_t * viewData = NULL;

// Here viewData points to NULL
cmdQueuePull(cmd, view, viewData);  // While inside this function, which updates the
                                                         // viewData pointer, the pointer is NOT NULL
                                                         // and correctly points to the location of viewData.

// Here it yet again points to NULL

When i enter the cmdQueuePull function and update the viewData pointer to point to a dictionary, then it works fine… Until it exits the cmdQueuePull function. After that, the pointer is back to its initial NULL state!

The viewData is not created inside the cmdQueuePull, it is created in another function with adl_memGet().

EDIT: I now know why this won’t work; because the adress of the dictionary is passed by value, so i cannot change this from inside the function :wink:

No - I think you are getting confused between the value of a pointer, and the value that it points to!

No, it does not point to NULL; the pointer’s value is NULL!

Then you need a pointer to a pointer! 8)

This is standard ‘C’ stuff; I suggest that you try this out on a “normal” system where you can single-step your code, inspect the pointer values, etc - without the added complications of Open-AT!

Thats exactly what i did :smiley: