我正在研究一些混合OCaml和C的代碼,在OCaml 3.12中引入了函數caml_release_runtime_system()
和caml_acquire_runtime_system()
(它們在早期版本中被稱爲別的東西),但我想要兼容回到3.10如果可能,是否有#ifdef
我可以使用它?我瀏覽了頭文件(在我的Debian系統上的/usr/lib/ocaml/caml
),並且找不到可能的東西。謝謝!編譯時檢測OCaml版本C
UPDATE:這是我做過什麼
這是我做過什麼:
#if OCAML_VERSION_MINOR >= 12
#include <caml/threads.h>
#else
#include <caml/signals.h>
#endif
#ifndef caml_acquire_runtime_system
#define caml_acquire_runtime_system caml_leave_blocking_section
#define caml_release_runtime_system caml_enter_blocking_section
#endif
這對3.11.2中的我不起作用。它在我的3.12.0版本中工作。 'ocamlopt -version'就是我在我的配置腳本中使用的,它在3.10.0到現在都有效。 – nlucaroni 2011-05-16 19:32:08
嗯,它需要工作在OCaml 3.10到,以及任何以上的版本,我猜... – Gaius 2011-05-16 20:00:29
@nlucaroni,@Gaius:我更新它使用ocamlopt -version,這是否適用於每個人3.10 ? – 2011-05-16 20:10:58