#include <iostream>
#include <string>
#include <vector>
extern "C"{
#include "sql.c"
}
class ReportsSync{
public:
string getQuery();
bool testQuery(string);
};
if i have a cpp file like tis, rather a .h file like this, wud i be able to call functions defines in sql.c as usual, like i am calling c++ functions?
for eg: if sql.c has a function named foo, which returns a datatype defines in sql.c itself, can i use the returned datatype inside maybe the testQuery(), manipulate it or give it to the next function?
For #include directives the preprocessor does just a text replacement. It is like you copy all text from sql.c to your source file.
So yes you can call the functions defined in sql.c.
The only thing I know of where care is required is if your C functions take function pointers as parameters to provide a callback. You should not throw exceptions in such a callback because C does not know about C++ exceptions.
However as already pointed out in the comments it is more common to #include header files. So you can use the functions of sql.h in more than one compilation unit (.c file).