[493] in Pthreads mailing list archive
syslog with pthreads
daemon@ATHENA.MIT.EDU (Stewart Gebbie)
Tue Nov 12 02:24:16 1996
Date: Tue, 12 Nov 1996 08:52:01 -0200 (GMT)
From: Stewart Gebbie <stewart@lin01.global.co.za>
To: pthreads@MIT.EDU
On 11-Nov-96 "Larry V. Streepy, Jr." wrote:
>>Stewart Gebbie wrote:
>>
>> Hi,
>>
>> I'm trying to use syslog with pthreads-1_60_beta5_9 without success.
>> to compile I used pg++ -o test_syslog test_syslog.cc
>>
>> -----------------test_syslog.cc-------------------
>> #include <syslog.h>
>>
>> int main(void)
>> {
>> openlog("MyProg",LOG_PID,LOG_USER);
>>
>> syslog(LOG_USER|LOG_DEBUG,"[%lx,%s:%d] %d: %s",0,__FILE__,__LINE__,123,"
>> blaa");
>>
>> closelog();
>>
>> return 0;
>> };
>> --------------------------------------------------
>>
>
>I don't know what OS your running on, but under Linux, the syslog.h
>header file fails to wrap the function decls in extern "C" constructs.
>You should check your OS and if this is the case, try this:
>
>extern "C" {
>#include <syslog.h>
>}
>
>int main(void)
>{
> ...
Thanks
I am running on Linux and I tried what you suggested with the extern...
It did compile now but gave no out put on the syslog. Whereas when I compile
with just g++ it works fine.
I am a novice to pthreads and don't really understand much of how it works
so I'm not really sure where to start looking.
Thanks again
stewart
/**************************************************************************
Stewart Gebbie
(H)+27 11 4323196 ``Only the ignorant man becomes angry.
(W)+27 11 6821895 The wise man understands.''
stewart@global.co.za
***********************************************************************/