DkSDK_OCamlForStaticBinary
This library target
is
created by the DkSDKProject_AddProject()
command.
It has a corresponding ALIAS target
named DkSDK::OCaml::ForStaticBinary
which is the preferred way to access the
target.
Always include this library when you are making an executable with
add_executable()
which should not
dynamically link to the native code OCaml shared libraries
(ex. libasmrun.so).
Note
On Windows there is no native code OCaml shared library.
Consider reading the DkSDK CMake Tutorial
to see how to use
this library.
Rules you must follow to decide on static or shared links to OCaml
It depends on how many add_library()
statements you have in your project that use
DkSDK::OCaml::ForLibOfSharedBinary
or
DkSDK::OCaml::ForLibOfStaticBinary
.
If you have more than one DkSDK::OCaml::ForLibOf*Binary
in your
project, then:
- All OCaml-using libraries must use
DkSDK::OCaml::ForLibOfSharedBinary
.
All OCaml-using executables, including executables that link to
the above libraries, must use
DkSDK::OCaml::ForSharedBinary
.
If you have one DkSDK::OCaml::ForLibOf*Binary
in your project, then:
All OCaml-using executables, including executables that link to
the above library, must use the same static/shared choice as
the above library.
In essence, the rules are so that static links to OCaml are not used when
there are two or more (2+) libraries that use OCaml.
That would result in two or more copies of OCaml internal state, and
your final executable would likely crash.