You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5467 Reporter: testcocoon Assigned to: meyer Status: closed (set by @xavierleroy on 2013-08-31T10:44:10Z) Resolution: duplicate Priority: normal Severity: minor Platform: Godi OS: Linux Version: 3.12.1 Category: ~DO NOT USE (was: OCaml general) Duplicate of:#4963
Bug description
When creating a binding to C++ code it is necessary to compile against a C++ compiler (ex g++).
in this case using caml_copy_string() function produces a linker issue:
llvmex_ocaml.o: In function llvmex_get_as_string': llvmex_ocaml.c:(.text+0x127): undefined reference to caml_copy_string(char const*)'
The problem is due to the fact that caml_copy_string is seen as C++ symbol (not as C symbol).
To correct the issue it is necessary to put extern "C" around the ocaml headers:
extern "C" {
#include "caml/alloc.h"
#include "caml/custom.h"
#include "caml/memory.h"
#include "caml/fail.h"
#include "caml/callback.h"
}
In my opinion this should not be the case. It would be better that the headers starts with:
#ifdef __cplusplus
extern "C" {
#endif
and ends with:
#ifdef __cplusplus
}
#endif
To enable the possibility to use it in C and C++.
The text was updated successfully, but these errors were encountered:
Original bug ID: 5467
Reporter: testcocoon
Assigned to: meyer
Status: closed (set by @xavierleroy on 2013-08-31T10:44:10Z)
Resolution: duplicate
Priority: normal
Severity: minor
Platform: Godi
OS: Linux
Version: 3.12.1
Category: ~DO NOT USE (was: OCaml general)
Duplicate of: #4963
Bug description
When creating a binding to C++ code it is necessary to compile against a C++ compiler (ex g++).
in this case using caml_copy_string() function produces a linker issue:
llvmex_ocaml.o: In function
llvmex_get_as_string': llvmex_ocaml.c:(.text+0x127): undefined reference to
caml_copy_string(char const*)'The problem is due to the fact that caml_copy_string is seen as C++ symbol (not as C symbol).
To correct the issue it is necessary to put extern "C" around the ocaml headers:
extern "C" {
#include "caml/alloc.h"
#include "caml/custom.h"
#include "caml/memory.h"
#include "caml/fail.h"
#include "caml/callback.h"
}
In my opinion this should not be the case. It would be better that the headers starts with:
#ifdef __cplusplus
extern "C" {
#endif
and ends with:
#ifdef __cplusplus
}
#endif
To enable the possibility to use it in C and C++.
The text was updated successfully, but these errors were encountered: