[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] include in a C++ program
From: |
Bruno Haible |
Subject: |
Re: [bug-gnulib] include in a C++ program |
Date: |
Mon, 11 Dec 2006 19:14:20 +0100 |
User-agent: |
KMail/1.9.1 |
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