![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compilation problem on HP-UX | varuntayur | High Level Programming | 1 | 02-19-2008 11:07 AM |
| compilation problem | phani_sree | High Level Programming | 2 | 10-25-2007 01:18 PM |
| compilation problem | mansoorulhaq | SUN Solaris | 0 | 10-19-2007 05:18 AM |
| fread64 fwrite64 compilation problem (undefined symbol) | Isax50 | High Level Programming | 3 | 08-16-2005 12:26 AM |
| gcc compilation | collins | High Level Programming | 3 | 01-19-2005 09:51 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Compilation problem with semtimedop
Hi,
I'm porting code from Windows to HP-UX 11, compiling with gcc. I have a call to semtimedop with 4 arguments as in the definition: Code:
int semtimedop(int, struct sembuf *, unsigned int, const struct timespec *); error: 'semtimedop' was not declared in this scope I looked in /usr/include/sys/sem.h to see what compilation flags are needed, and it seems to me that there is an anomally there. In the excerpt from sem.h at the bootom, I have left the ifdefs and removed the code between them (faithfully, I hope) until the definition of semtimedop. As I understand it, it is impossible to reach the correct definition of semtimedop with arguments, since on the one hand it is under a global Code:
#ifdef _INCLUDE_XOPEN_SOURCE Code:
if defined(_INCLUDE_XOPEN_SOURCE) || defined(__LP64__) Code:
extern int semtimedop(); Am I wrong? What is the correct way to solve this? Thank you, Rimon Edited excerpt from sem.h: Code:
#ifdef _INCLUDE_XOPEN_SOURCE
# ifndef _NO_USER_PROTOS
# ifdef _PROTOTYPES
# if defined(_INCLUDE_XOPEN_SOURCE) || defined(__LP64__)
extern int semop(int, struct sembuf *, size_t);
# else /* not XOPEN_SOURCE or LP64 */
extern int semop(int, struct sembuf *, unsigned int);
# ifdef _INCLUDE_HPUX_SOURCE
extern int semtimedop(int, struct sembuf *, unsigned int, const struct timespec *);
# endif /* _INCLUDE_HPUX_SOURCE */
# endif /* not XOPEN_SOURCE or LP64 */
# else /* not _PROTOTYPES */
extern int semctl();
extern int semget();
extern int semop();
# ifdef _INCLUDE_HPUX_SOURCE
extern int semtimedop();
# endif /* _INCLUDE_HPUX_SOURCE */
# endif /* not _PROTOTYPES */
# ifdef __cplusplus
}
# endif /* __cplusplus */
# endif /* not _NO_USER_PROTOS */
#endif /* _INCLUDE_XOPEN_SOURCE */
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
What code are you porting? I do the following mapping:
Win32 Event -> pthread_cond_t Win32 Mutex -> pthread_mutex_t On HPUX, I use -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT |
|
#3
|
|||
|
|||
|
The relevant portion of the code I am porting manages semphores between the threads in my application. The specific call which gives me the compliation error is:
Code:
rc = semtimedop(*sem_idp, sops, nsops, t_spec); |
|
#4
|
|||
|
|||
|
I recommend you use a pthread construct to do what you want to do, or build a semaphore using a pthread condition.
|
|||
| Google The UNIX and Linux Forums |