Operating System - HP-UX
1757487 Members
3000 Online
108862 Solutions
New Discussion

hsearch and the ENTRY structure

 
Leslie Chaim
Regular Advisor

hsearch and the ENTRY structure

Hello,

I'm trying to use the hsearch() routines from search.h and I have some problems.

First, I get
cc: "test.c", line 64: error 1588: "ENTRY" undefined:(

I did include what am I missing here?


Second, the WARNING section of the man page indicates:

" Only one hash search table can be active at any given time."

Does that mean that the internal table is global? Just want to verify, and if so, can I do a hcreate(nel) in foo() and then do a hsearch(item,ENTER) in bar() and hsearch(item,FIND) is baz()?

Finally, is there any way around this limitation?


Thanks in advance,
Leslie
If life serves you lemons, make lemonade
1 REPLY 1
Leslie Chaim
Regular Advisor

Re: hsearch and the ENTRY structure

Well, I looked at the header file in /usr/include/search.h.

Much to my surprise I found there is a:

#ifdef _INCLUDE_XOPEN_SOURCE
...
#endif /* _INCLUDE_XOPEN_SOURCE */

In fact the example given in the manpage does not work unless you:

#define _INCLUDE_XOPEN_SOURCE

I am still looking for the other questions.

Regards,
Leslie
If life serves you lemons, make lemonade