What are some good tips when working with...
Articles and Tips: qna
01 Mar 2001
Q.
What are some good tips when working with context handles in multiple NDS tree environments?
A.
When writing NDS-aware applications in C, you need to work with context handles. A context handle is a pointer to structure that holds several important variables like default NDS tree name, default name context, flags, and so on. In an environment with multiple trees, it is extremely important to set variables in this structure correctly.
If you create a new context handle by issuing NWDSCreateContextHandle() API, the new structure is internally created, and initialized with default values. That means it is set to the default tree name, default name context, and so on. If your NDS-aware application requires switching among different trees, it is not sufficient to change the context's variable holding tree name only. You would have a valid tree name, but at the same time an invalid name context and most probably also an invalid connection held in your context structure. This would cause any consecutive NWDS APIs to fail.
When switching among trees in your application, the context's name context must be also changed accordingly, and the DCK_LAST_CONNECTION flag should be set to a valid connection number or be reset to -1. (Thanks to Rostislav Letos of RoletoSoft)
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.