Discussion:
trouble with native metaocaml
Ronald Garcia
2009-07-11 18:36:05 UTC
Permalink
Hi all,

I have an app that I have successfully compiled and run under
bytecode, but is failing under native code. The error it gives before
dying is as follows:

Fatal error: exception Natdynlink.Error("./plugin1.so: undefined
symbol: caml_apply9")

I would appreciate any input on what might cause this to happen.

Thanks,
Ron
o***@okmij.org
2009-07-14 13:47:04 UTC
Permalink
Post by Ronald Garcia
Fatal error: exception Natdynlink.Error("./plugin1.so: undefined
symbol: caml_apply9")
Please see the extensive discussion of this issue on the MetaOcaml
hackers mailing list on Feb 2006. Here is a brief description and the
work-around, excerpted from one of the earlier messages:

There may be a rare condition when dynamic loading fails, if the
generated code uses functions of higher arity or does currying to a
larger extent than that in the main code. This is because
currying/apply_n code is generated in the start-up file. I'd expect
this to be a rare condition that may occur only when the main code is
"too simple" (usually it is never the case because the main code
includes stdlib, and the latter is quite complex already). The problem
will manifest itself is the failure of .! (exception will be
thrown). The workaround is easy: just add to the main code some
functions of higher-arity. You don't have to execute them; they just
have to be present.

Cheers,
Oleg

Loading...