C Library Wrapper in C++

Discussion in 'C++' started by Ian, Oct 16, 2003.

  1. Ian

    Ian Guest

    Has anyone had any experience in writing wrappers for older C
    libraries?
    What I'm looking at doing is creating a wrapper C++ object as a front
    end to an older C library, also the library is not thread-safe, which
    I have to somehow make safe for multi-threading (CRITICAL_SECTIONS
    maybe) for integration into a server.

    Thanks,

    Ian
     
    Ian, Oct 16, 2003
    #1
    1. Advertising

  2. Ian

    Jack Klein Guest

    On 16 Oct 2003 14:12:08 -0700, (Ian) wrote in
    comp.lang.c++:

    > Has anyone had any experience in writing wrappers for older C
    > libraries?


    Yes, many people have.

    > What I'm looking at doing is creating a wrapper C++ object as a front
    > end to an older C library, also the library is not thread-safe, which
    > I have to somehow make safe for multi-threading (CRITICAL_SECTIONS
    > maybe) for integration into a server.
    >
    > Thanks,


    The C++ language does not define or support multiple threads of
    execution, so that aspect of your question is off-topic here. You
    need to ask in a Windows programming group.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c /faq
     
    Jack Klein, Oct 17, 2003
    #2
    1. Advertising

  3. Ian

    Alan Gifford Guest

    Jack Klein <> wrote in message news:<>...
    > On 16 Oct 2003 14:12:08 -0700, (Ian) wrote in
    > comp.lang.c++:
    >
    > > Has anyone had any experience in writing wrappers for older C
    > > libraries?

    >
    > Yes, many people have.
    >
    > > What I'm looking at doing is creating a wrapper C++ object as a front
    > > end to an older C library, also the library is not thread-safe, which
    > > I have to somehow make safe for multi-threading (CRITICAL_SECTIONS
    > > maybe) for integration into a server.
    > >
    > > Thanks,

    >
    > The C++ language does not define or support multiple threads of
    > execution, so that aspect of your question is off-topic here. You
    > need to ask in a Windows programming group.




    So you mean you can't use multithreading with C++ programs in Linux?
    A co-worker was telling me about using C++ classes to handle locks and
    some other stuff in multithreading (I don't know how to do it yet)
    that made it really easy, but I think he was talking about Windows NT
    programming.
     
    Alan Gifford, Oct 18, 2003
    #3
  4. Ian

    red floyd Guest

    Alan Gifford wrote:
    > Jack Klein <> wrote in message news:<>...
    >
    >>On 16 Oct 2003 14:12:08 -0700, (Ian) wrote in
    >>comp.lang.c++:
    >>
    >>
    >>>Has anyone had any experience in writing wrappers for older C
    >>>libraries?

    >>
    >>Yes, many people have.
    >>
    >>
    >>>What I'm looking at doing is creating a wrapper C++ object as a front
    >>>end to an older C library, also the library is not thread-safe, which
    >>>I have to somehow make safe for multi-threading (CRITICAL_SECTIONS
    >>>maybe) for integration into a server.
    >>>
    >>>Thanks,

    >>
    >>The C++ language does not define or support multiple threads of
    >>execution, so that aspect of your question is off-topic here. You
    >>need to ask in a Windows programming group.

    >
    >
    >
    >
    > So you mean you can't use multithreading with C++ programs in Linux?
    > A co-worker was telling me about using C++ classes to handle locks and
    > some other stuff in multithreading (I don't know how to do it yet)
    > that made it really easy, but I think he was talking about Windows NT
    > programming.


    No, he means that it's not built into the Standard C++ language.
    Wrappers and such for multithreading APIs are OS and/or MT
    implementation specific, and are not discussed in the standard.

    That said, I have several classes that wrap up some Win32 multithreading
    primitives. They are implemented in Standard C++, but they are not part
    of Standard C++.

    C++ is a great language for this sort of wrapper, because it helps to
    avoid problems such as mutexes and critical sections accidentally left
    locked. But because they're OS specific, they're not in the standard.
     
    red floyd, Oct 18, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Francesco Bochicchio
    Replies:
    6
    Views:
    488
    Thomas Heller
    Jul 4, 2003
  2. maxwell hammer

    Wrapper to speex and ffmpeg library

    maxwell hammer, Jan 17, 2004, in forum: Python
    Replies:
    0
    Views:
    503
    maxwell hammer
    Jan 17, 2004
  3. Mark McEahern
    Replies:
    1
    Views:
    447
    Duncan Booth
    Feb 2, 2004
  4. Heiko Wundram
    Replies:
    1
    Views:
    443
    Paul Rubin
    Jun 3, 2004
  5. mastermagrath

    is the C library a wrapper for windows API?

    mastermagrath, Aug 29, 2006, in forum: C Programming
    Replies:
    29
    Views:
    715
    Mark McIntyre
    Sep 4, 2006
Loading...

Share This Page