diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index 58496c068..4eaa9a5fa 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -811,8 +811,16 @@ int R::top(Node *n) { Printf(s_init, "# This is an automatically generate file by the R module for SWIG.\n\n"); outputCommandLineArguments(s_init); + Printf(f_wrapper, "#ifdef __cplusplus\n"); + Printf(f_wrapper, "extern \"C\" {\n"); + Printf(f_wrapper, "#endif\n\n"); + Language::top(n); + Printf(f_wrapper, "#ifdef __cplusplus\n"); + Printf(f_wrapper, "}\n"); + Printf(f_wrapper, "#endif\n"); + String *type_table = NewString(""); SwigType_emit_type_table(f_runtime,f_wrapper); Delete(type_table); @@ -827,7 +835,6 @@ int R::top(Node *n) { if(registrationTable) outputRegistrationRoutines(f_init); - /* Now arrange to write the 2 files - .S and .c. */ DumpCode(n, module);