Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005467OCamlOCaml generalpublic2012-01-06 23:352013-08-31 12:44
Reportertestcocoon 
Assigned Tomeyer 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionduplicate 
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" {
#endif

and ends with:
#ifdef __cplusplus
}
#endif

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
(0006619)
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
(0006620)
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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker