[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] fix: make extern "C" automatic in header files

From: Steven G. Johnson
Subject: [Help-glpk] fix: make extern "C" automatic in header files
Date: Mon, 30 May 2005 15:14:07 -0400
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

I'm using GLPK 4.8, and I notice that you still require C++ users to wrap extern "C" { ... } around the headers.

There is an easy way to make this automatic.  Just put:

#ifdef __cplusplus
extern "C" {
#endif    /* __cplusplus */

at the beginning of your header file and

#ifdef __cplusplus
}         /* extern "C" */
#endif    /* __cplusplus */

at the end. (This is standard boilerplate that many C header files use in order to work with C++.)

I think that nesting extern "C" braces is allowed (g++ -pedantic -Wall allows it), so this shouldn't cause backwards-compatibility problems for existing C++ code that uses GLPK.

Steven G. Johnson

reply via email to

[Prev in Thread] Current Thread [Next in Thread]