Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Js_of_ocaml:调用ocurl和str时缺少原语_Curl_Ocaml_Js Of Ocaml - Fatal编程技术网

Js_of_ocaml:调用ocurl和str时缺少原语

Js_of_ocaml:调用ocurl和str时缺少原语,curl,ocaml,js-of-ocaml,Curl,Ocaml,Js Of Ocaml,我使用包curl发出Http请求(包str使用regex)。我在我的项目中编译文件,没有问题,当我用js_of_ocaml编译file.byte时,我有以下错误: js_of_ocaml——禁用genprim foo.byte Missing primitives: helper_curl_easy_cleanup helper_curl_easy_duphandle helper_curl_easy_getinfo helper_curl_easy_init helper_

我使用包curl发出Http请求(包str使用regex)。我在我的项目中编译文件,没有问题,当我用js_of_ocaml编译file.byte时,我有以下错误:

js_of_ocaml——禁用genprim foo.byte

Missing primitives:
  helper_curl_easy_cleanup
  helper_curl_easy_duphandle
  helper_curl_easy_getinfo
  helper_curl_easy_init
  helper_curl_easy_perform
  helper_curl_easy_setopt
  helper_curl_global_init
  re_search_forward
  re_string_match
当我包含生成的js文件时,我在web控制台中出现以下错误:
uncaughtreferenceerror:helper\u curl\u global\u init未定义


我知道有缺少的原语,这是造成我的错误的原因,但有一个解决方案可以解决这个问题?

一些OCaml库使用纯C编写的原语。显然,js_of_OCaml无法将它们链接到Javascript。在这种情况下,您需要手动实现它们,如中所述


Str模块中的函数在ECMAScript库中具有等价物,因此您可能需要使用它们(如果有人没有创建与Str具有相同接口的helper模块并在引擎盖下调用Javascript函数)

要在js\u of\u ocaml中执行http请求,您需要使用该模块: