This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Making a new GCC routine visible


On 19 May 2012 19:09, Amittai Aviram wrote:
> Aha! ?It's declared as
> void * domp_malloc(size_t);
> in a header I #include into my program--but I had forgotten to mark that #include as "extern 'C'." ?I just tried that and it works!--
>
> extern "C" {
> #include domp_defs.h
> }
>
> So this turned out not to be a GCC issue but just my lack of practice in mixing C and C++ code. ?Thank you so much for the hint!

Thought so :-)

It's better to make the header self-sufficient:

#ifdef __cplusplus
extern "C" {
#endif
void * domp_malloc(size_t);
#ifdef __cplusplus
extern "C" {
#endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]