473,574 Members | 3,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C Library Wrapper in C++

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_SECTI ONS
maybe) for integration into a server.

Thanks,

Ian
mc****@yahoo.co m
Jul 19 '05 #1
3 10238
On 16 Oct 2003 14:12:08 -0700, mc****@yahoo.co m (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_SECTI ONS
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.l earn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Jul 19 '05 #2
Jack Klein <ja*******@spam cop.net> wrote in message news:<cl******* *************** **********@4ax. com>...
On 16 Oct 2003 14:12:08 -0700, mc****@yahoo.co m (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_SECTI ONS
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.
Jul 19 '05 #3
Alan Gifford wrote:
Jack Klein <ja*******@spam cop.net> wrote in message news:<cl******* *************** **********@4ax. com>...
On 16 Oct 2003 14:12:08 -0700, mc****@yahoo.co m (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_SECTI ONS
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.

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2280
by: Mark McEahern | last post by:
I just wrote a very simple wrapper for the PayFlow Pro SDK (see below). A friend of mine did this before, but I didn't have access to his source, so I took it as a learning opportunity for me to write a C wrapper. I did a little searching to see whether anyone had done anything like this for Python. I didn't find anything. I did find...
1
1824
by: Yaniv Oliver | last post by:
Hey, I'm currently writing a C# wrapper for a library that was originally written in C. The wrapper is basiclly working, but I'm having trouble writing a wrapper for this kind of code segment: typedef int (*callback_function)(char *string); __declspec(dllimport) BOOL DLL(some_function)(callback_function some_ther_function);
0
2479
by: Claire | last post by:
Hi Ive been using Mattias Sjögren's example at http://www.msjogren.net/dotnet/eng/samples/dotnet_dynpinvoke.asp to load an unmanaged 3rd party dll dynamically when my object is created. Calling the "CreateDllAssembly" function below does this. When my wrapper is disposed of, I want the dll to be unloaded from memory. See the "dispose"...
1
1709
by: Steve Terepin | last post by:
I've found some rather worrying articles (Mixed Mode Library Assembly bug, Richard Grimes, Windows Developer Network Sept 2003 ; and Knowledge Base Article 814472 ) that point out the need to use the /noentry switch and an explicit initialisation procedure, to be able to safely use Managed C++ assemblies that call down into standard C library...
1
7152
by: Adam Clauss | last post by:
I have an unmanaged C++ library that I need to use through C#. I created a Managed C++ class library and through it wrote a wrapper class to call what I need. However, one of the methods (an Initialize function in the unmanaged library) crashes everytime I call it. Initialize calls another function 'GetInstance' (a static member function of...
5
2152
by: Octal | last post by:
How does the lambda library actually works. How does it know how to evaluate _1, how does it recognize _1 as a placeholder, how does it then calculate _1+_2, or _1+2 etc. The source files seem a bit complicated so any explanation would be appreciated. Thanks
1
2353
by: dfj225 | last post by:
While my question doesn't pertain specifically to python programming, it is a result of developing a python module, so I'm hoping someone here might have experience with this issue. So, first a little background to how the system works right now. I am developing a module for Python. The original code is written in C++ and I am creating a...
3
2954
by: jonlynch71 | last post by:
Hi, I have a statically-linked C library (.lib) that I need to be able to access from C#. I understand that the best way to do this is to code a C++ managed wrapper. How do I create this wrapper? One of the functions in this library is as follows: int *func2 (int *ary, int n, char *str)
2
5689
by: Serman D. | last post by:
Hi all, I'm trying to complete the samples from the excellent 2003 developerWorks article "Bringing the Power of Regular Expression Matching to SQL" by Knut Stolze: http://tinyurl.com/3bhrnn I've managed to compile and link the C code from "Listing 5", the regexpSimple() wrapper (see link). The build options are pretty much
1
1667
by: £ukasz Z±bik | last post by:
I have project that uses managed c++ where I use c - library, this library contains some variables named generic, during compilation I get error: Error 1 error C2146: syntax error : missing ';' before identifier 'generic', Problem is that in dotNet generic is a keyword, and I cannot change this name becouse I have only lib file and includes....
0
7837
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7755
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
6504
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5647
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5333
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3770
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2268
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1366
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1097
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.