Pjlib?

This is a discussion on Pjlib? within the C Programming forums, part of the General Programming Boards category; Was reading up on some memory management crap and ran across PJLIB . It sounds pretty slick...ultraportable, ultrafast thread/socket/mutex/semaphore/high-res timer/everything ...

  1. #1
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    999

    Pjlib?

    Was reading up on some memory management crap and ran across PJLIB.

    It sounds pretty slick...ultraportable, ultrafast thread/socket/mutex/semaphore/high-res timer/everything library. Has anyone used this?

    In addition, it says:
    Do NOT Use ANSI C
    Contrary to popular teaching, ANSI C (and LIBC) is not the most portable library in the world, nor it's the most ubiquitous. For example, LIBC is not available in Linux kernel. Also normally LIBC will be excluded from compilation of RTOSes to reduce size.
    So for maximum portability, do NOT use ANSI C. Do not even try to include any other header files outside <include/pj>. Stick with the functionalities provided by PJLIB.
    If ANSI C isn't the most portable, then what is?

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Epy View Post
    If ANSI C isn't the most portable, then what is?
    ISO C. Or maybe POSIX is implied here, which pretty much sticks to ISO.

    Of course, if you aren't suppose to use any other headers, I would be very weary of presuming the aim here is portability.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,306
    Quote Originally Posted by Epy
    If ANSI C isn't the most portable, then what is?
    PJLIB?

    Their assertion is probably FUD at this point of time, since citing a few cases where a library is not available or not fully available does not substantiate the claim that it "is not the most portable library in the world, nor it's the most ubiquitous". You actually need to provide proof that another library is more portable and cite statistics to show that another library is more ubiquitous.

    It is true that the C standard library is not available in the Linux kernel, but in theory one can make it available. Likewise, it might be true that "LIBC will be excluded from compilation of RTOSes to reduce size", but it may also be true that parts of PJLIB may be disabled for the same reason, and that would mean that PJLIB is not necessarily quite as ultraportable as it presents itself.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    By the way, Epy, if you are writing on linux, I'm gonna recommend glib (which is supposedly portable elsewhere, but I dunno) for some generic higher functioning. For starters, it is already used in virtually everything on yer desktop already.

    Check it out:
    GLib Reference Manual
    timers, threads, hash tables, btrees, lists, queues, wicked IO stuff, char conversion, unicode, XML, etc etc.
    Last edited by MK27; 01-28-2010 at 01:09 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    999
    Quote Originally Posted by MK27 View Post
    ISO C. Or maybe POSIX is implied here, which pretty much sticks to ISO.

    Of course, if you aren't suppose to use any other headers, I would be very weary of presuming the aim here is portability.
    Okay, maybe I'm just fail today, but I couldn't readily find anything on the differences between ISO and ANSI C. Care to give me a few examples?

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Epy View Post
    Okay, maybe I'm just fail today, but I couldn't readily find anything on the differences between ISO and ANSI C. Care to give me a few examples?
    I believe the ISO standard replaced the ANSI standard, more or less, but probably wikipedia can fill you in.

    (chanting subliminal voice: glib, glib, glib...)
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    999
    Hahahaha, yeah, I checked it out and I'd bet that PJLIB probably just a trimmed down version of GLib ("One feature of the LGPL is that one can convert any LGPLed piece of software into a GPLed piece of software"). Most of the core features are the same. I'll stick with GLib (whenever I need it). Thanks.

  8. #8
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    In that case, you might want to just use pthread for threads -- I am almost certain that "gthreads" are built on top of pthreads, and they work fine together (pthreads and glib).
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,854
    > For example, LIBC is not available in Linux kernel
    It's not the kernels job to provide it. Libc is provided by the compiler, not the environment.

    The compiler writer adapts their libc to work with the underlying environment, to provide your super-portable program (which depends only on libc) with the standard API it knows and expects.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  10. #10
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Quote Originally Posted by Salem View Post
    > For example, LIBC is not available in Linux kernel
    It's not the kernels job to provide it. Libc is provided by the compiler, not the environment.

    The compiler writer adapts their libc to work with the underlying environment, to provide your super-portable program (which depends only on libc) with the standard API it knows and expects.
    Indeed. Think of libc as the link between kernel space and user space. A bit simplified, but if you call a libc function to print text or open a file then libc forwards that call to the kernel.
    Chances are if you are writing kernel space code that is so complex it requires an external library to function then it would be better of running in user space instead.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21