Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* compilation under OSF1
@ 1995-07-26  4:00 Chua Koon Teck
  1995-07-27  4:00 ` Dan Pop
  0 siblings, 1 reply; 2+ messages in thread
From: Chua Koon Teck @ 1995-07-26  4:00 UTC (permalink / raw)


Hi

I am trying to compile a very simple program under OSF1 which contains 
the command getlogin_r(char*, int).  My program is :

include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main(void)
{
        int fd;
        char* login;
        int len;
        int status;

        status = getlogin_r(login, len);

        printf("status: %d, login: %s\n", len, login);
}

I uses "cc -o pinewrap pinewrap.c".  But it seems that the linker could 
not resolve the getlogin_r command.

Any help will be greatly appreciated. Appreciate if reply be  email to me.



Thank you.

Have a nice day.



Regards


Chua Koon Teck		
koonteck@singnet.com.sg
SingNet			
URL="http://www.singnet.com.sg/"	
Singapore Telecom 



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: compilation under OSF1
  1995-07-26  4:00 compilation under OSF1 Chua Koon Teck
@ 1995-07-27  4:00 ` Dan Pop
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Pop @ 1995-07-27  4:00 UTC (permalink / raw)


In <3v4ki1$h6v@lantana.singnet.com.sg> koonteck@merlion.singnet.com.sg (Chua Koon Teck) writes:

>I am trying to compile a very simple program under OSF1 which contains 
>the command getlogin_r(char*, int).  My program is :
>
>include <sys/types.h>
>#include <sys/stat.h>
>#include <fcntl.h>
>#include <unistd.h>
>
>int main(void)
>{
>        int fd;
>        char* login;
>        int len;
>        int status;
>
>        status = getlogin_r(login, len);
                             ^^^^^  ^^^
Neither login nor len are initialized.  getlogin_r will, probably, cause
a segmentation fault.
>
>        printf("status: %d, login: %s\n", len, login);
>}
>
>I uses "cc -o pinewrap pinewrap.c".  But it seems that the linker could 
>not resolve the getlogin_r command.

The man page isn't as helpful as it should have been, because it doesn't
tell you to put -lc_r at the end of your cc line if you want to use 
getlogin_r.  But fix your code first.

Dan
--
Dan Pop
CERN, CN Division
Email: Dan.Pop@mail.cern.ch 
Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-07-27  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-07-26  4:00 compilation under OSF1 Chua Koon Teck
1995-07-27  4:00 ` Dan Pop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox