Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ linkage in OCaml headers #3754

Closed
vicuna opened this issue Sep 20, 2002 · 1 comment
Closed

C++ linkage in OCaml headers #3754

vicuna opened this issue Sep 20, 2002 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Sep 20, 2002

Original bug ID: 1400
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Jere Sanisalo
Version: 3.05
OS: WinXP
Submission from: ip213-185-36-33.laajakaista.mtv3.fi (213.185.36.33)

I'm currently developing a native library for OCaml with C++. Everything seems
to compile ok, but in the linking phase it complains about missing ocaml
functions (such as failwith, alloc and alloc_tuple). The problem is, that the
ocaml header files do not specify 'extern "C"' for function declarations under
C++ (they should be defined as 'extern' under C, but this is not done either, as
I see it).

A quick hack is to include the header files like:

extern "C" {
#include <caml/alloc.h>
#include <caml/fail.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
}

This compiles, links and works as expected (but is a temporary hack
nonetheless).

@vicuna
Copy link
Author

vicuna commented Sep 26, 2002

Comment author: administrator

Proposed workaround is the right thing to do.

@vicuna vicuna closed this as completed Sep 26, 2002
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant