This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C6000 NDK: What is Handle?

Hello Everyone,

From last one week I am working on TI's NDK for C6454 processor. I am using getting started guide and other documents to understand the architecture of the code (I am feeling little difficult !!)

However, one question every time (every time) arises in my mind whenever I see something "Handle". Many times it is passed parameter to a function or a variable. For example,

static HANDLE hEcho=0,hEchoUdp=0,hData=0,hNull=0,hOob=0; // As a variables
Uint32 EMAC_open(int physicalIndex, Handle hApplication, EMAC_Config *pEMACConfig, Handle *phEMAC) //Function parameter

Which is defined as

typedef void * Handle;

My question is what is this Handle??? What is doing?? What is significance?


Kindly help :)

Thanks in advance :)

  • The "Handle" is a void pointer and it could implicit conversion to any pointer (it could be any pointer) when we don't know which type of data would get in that particular function argument.

  • Thank You Titus!

    So, does it mean, HANDLE can point any pointer? E.g., variable pointer , array pointer or even a structure pointer?
    So, is it not concept of double pointer then? Does this mean, only advantage is I can point to any data-type ?? or is there any more advantages are there??? Please give some more information regarding this.

    Thank you for giving your valuable time & sharing knowledge :-) :-)

    --
    Aravind D Chakravarti
    Accord Software and Systems Pvt. Ltd,
    Bangalore
  • Hi Aravind,

    First you have to notice that the "typedef void * Handle" and HANDLE variables case sensitivity is not the same... I mean you have to check whether the HANDLE is of type void *.

    secondly, assuming that the HANDLE is of type void*, all the variables hEcho,hEchoUdp,hData,hNull,hOob are variable pointers of type "void *" which can hold the address of variable of any data type( int/ float/ char). And it is a single pointer only not double pointer. It can point to address and not the pointer.

    Please refer to any C books like " The C programming language" by Dennis Ritchie or " The complete C++ reference" , Part - I.

    Regards,

    Shankari

  • Thank You Shankari,
    I understood to some extent. Since NDK is little tricky (I am correct right?) I am feeling little void!
    As per your suggestion I will refer the C book and come back to you if I get any doubts!!

    Thanks Titus!

    Regards,
    Aravind D Chakravarti
    Accord Software and Systems Pvt. LTD,
    Bangalore