C++ wrapper for C library
- by Maximilien
Hi,
Recently I found a C library that I want to use in my C++ project.
This code is configured with global variables and writes it's output to memory pointed by static pointers.
When I execute my project I would like 2 instances of the C program to run: one with configuration A and one with configuration B. I can't afford to run my program twice, so I think there are 2 options:
Make a C++ wrapper: The problem here is that the wrapper-class should contain all global/static variables the C library has. Since the functions in the C library use those variables I will have to create very big argument-lists for those functions.
Copy-paste the C library: Here I'll have to adapt the name of every function and every variable inside the C library.
Which one is the fastest solution?
Are there other possibilities to run 2 instances of the same C source?
Thanks,
Max