P
puzzlecracker
I am writing a C++ program under linux and one of the modules uses
c for file system calls to traverse and retrieve files, etc. I am
thinking of writing that module purely in C and linking into my program
(would someone argue that I should still complile it in c++?). How is
it done?
would below snippet work?
//cpp file
include<filestat.h>
//regular c++ includes.
using std::cout;
using std:string;
int main(int argc, char* argv []){
// my program;
}
//filestat.h
#ifndef FILESTAT_H
#define FILESTAT_H
extern "C"
{
//all c functions
}
#endif
Unsure how many of you here use g++ as a compiler of choice, but were I
to compile the module above with it, would I be able to link that part
against C program or should I avoid extern "C" business as outdate and
soon to be deprecated?
Thanks.
c for file system calls to traverse and retrieve files, etc. I am
thinking of writing that module purely in C and linking into my program
(would someone argue that I should still complile it in c++?). How is
it done?
would below snippet work?
//cpp file
include<filestat.h>
//regular c++ includes.
using std::cout;
using std:string;
int main(int argc, char* argv []){
// my program;
}
//filestat.h
#ifndef FILESTAT_H
#define FILESTAT_H
extern "C"
{
//all c functions
}
#endif
Unsure how many of you here use g++ as a compiler of choice, but were I
to compile the module above with it, would I be able to link that part
against C program or should I avoid extern "C" business as outdate and
soon to be deprecated?
Thanks.