Lorenzo Bettini wrote:
> I've just started using gnulib, and I have a doubt.
> I've imported strdup and I'm using it in a C++ program.
> 
> Now should I import strdup.h in the C++ program simply like this
> 
> #include "strdup.h"
> 
> Or should I wrap it as follows?
> 
> extern "C" {
> #include "strdup.h"
> }

Just do an

   #include "strdup.h"

and report it to us if it leads to link errors. We are willing to put
extern "C" markers in gnulib's header files, since it's only a small effort
to do so.

It is not safe to write

  extern "C" {
  #include "strdup.h"
  }

because you don't know which other headers strdup.h may include; some of
them may contain C++-only declarations and fail to compile if included this
way.

Bruno


Reply via email to