C Library Wrapper in C++

I

Ian

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
(e-mail address removed)
 
J

Jack Klein

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
 
A

Alan Gifford

Jack Klein said:
Yes, many people have.


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.
 
R

red floyd

Alan said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top