Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #157550

Re: I need help understand some c code

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: I need help understand some c code
Date 2020-12-20 20:51 -0800
Organization None to speak of
Message-ID <87czz3bw39.fsf@nosuchdomain.example.com> (permalink)
References <rrp1gb$kle$1@dont-email.me> <rrp8ij$r14$1@dont-email.me>

Show all headers | View raw


T <T@invalid.invalid> writes:
[...]
> I need to cancel this question.  I am making the
> mistake of calling a library in C (time.h) and what
> I really need is to call a function inside a
> /usr/lib64/libxxx.so.x.  And I do not know what
> that is.  (Google keeps pointing me back to time.h.).
>
> And since I am only look to create examples for a
> paper I am writing, I do not really care what
> example I use.

This shows a serious lack of understanding about how C works, and
possibly compiled languages in general.  I don't say this to be
insulting, but to suggest that you don't know enough to know what
questions you need to ask.

time.h is a header, not a library.  It provides an interface to
library code (in this case, the C standard library) by providing
type and function declarations.  The code that implements those
functions may well be in /usr/lib64/libxxx.so.x on one system, or
in some completely different place on another.  As a C programmer,
you very probably don't need to know.  The compiler and/or linker
handles it all for you.  If you know to write "#include <time.h>" at
the top of your C source file, that's probably all you need to know.

If I write a simple program, say one that prints "hello world",
I create a source file, then I compile, link, and run it.  On my
system:

    gcc hello.c -o hello
    ./hello

gcc, and the tools it invokes, take care of all the details for me.
99% of the time I literally do not care where time.h or the library
that implements the time function exist on the system.

Find yourself a decent C tutorial and follow it.  There are
undoubtedly some decent ones online.  Perhaps others can suggest one.
(There are a lot of really bad ones, and you don't yet know enough
to tell the difference.)

Since you're apparently working on interfacing between C and another
language, you're likely to need more knowledge than you'd need just to
write and run C programs, but I suggest starting with that as a minimum.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

I need help understand some c code T <T@invalid.invalid> - 2020-12-20 18:32 -0800
  Re: I need help understand some c code Siri Cruise <chine.bleu@yahoo.com> - 2020-12-20 19:03 -0800
  Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-20 19:56 -0800
    Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-20 20:02 -0800
      Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-20 20:43 -0800
        Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-20 21:06 -0800
          Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-20 21:56 -0800
  Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-20 20:33 -0800
    Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-20 20:51 -0800
      Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-20 21:11 -0800
        Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-20 22:10 -0800
          Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-20 22:15 -0800
      Re: I need help understand some c code Bart <bc@freeuk.com> - 2020-12-21 13:11 +0000
        Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-21 13:47 -0800
          Re: I need help understand some c code scott@slp53.sl.home (Scott Lurndal) - 2020-12-23 17:18 +0000
            Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-23 12:05 -0800
        Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-21 14:25 -0800
  Re: I need help understand some c code Bonita Montero <Bonita.Montero@gmail.com> - 2020-12-21 05:45 +0100
  Re: I need help understand some c code Bart <bc@freeuk.com> - 2020-12-21 12:16 +0000
  Re: I need help understand some c code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-21 20:03 +0000

csiph-web