Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005467OCaml~DO NOT USE (was: OCaml general)public2012-01-06 23:352013-08-31 12:44
Assigned Tomeyer 
PlatformGodiOSLinuxOS Version
Product Version3.12.1 
Target VersionFixed in Version 
Summary0005467: no extern "C" into ocaml C-stub headers
DescriptionWhen 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" {

and ends with:
#ifdef __cplusplus

To enable the possibility to use it in C and C++.
TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0004963closedlefessan Please add extern "C" declarations (for C++) in installed headers 

-  Notes
meyer (developer)
2012-01-06 23:58

Sorry a bit tired today, I thought i changed to resolve by mistake, now I see it's a dupe
protz (manager)
2012-01-07 00:04

No worries!

- Issue History
Date Modified Username Field Change
2012-01-06 23:35 testcocoon New Issue
2012-01-06 23:44 meyer Assigned To => meyer
2012-01-06 23:44 meyer Status new => assigned
2012-01-06 23:45 protz Relationship added duplicate of 0004963
2012-01-06 23:45 protz Status assigned => resolved
2012-01-06 23:45 protz Resolution open => duplicate
2012-01-06 23:57 meyer Status resolved => new
2012-01-06 23:58 meyer Note Added: 0006619
2012-01-06 23:58 meyer Status new => resolved
2012-01-07 00:04 protz Note Added: 0006620
2013-08-31 12:44 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker