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

Optional threading support #80

Merged
merged 4 commits into from
Oct 29, 2013
Merged

Optional threading support #80

merged 4 commits into from
Oct 29, 2013

Conversation

yallop
Copy link
Owner

@yallop yallop commented Oct 29, 2013

Functorize the foreign package to provide a thread-safe version and a version that doesn't use threads. The META file is set up so that ocamlfind will link against the right version according to the flags used to build the client library.

Without -thread:

$ ocamlfind ocamlc -verbose -linkpkg -package ctypes.foreign tst.cmo -o tst
Effective set of compiler predicates: pkg_unix,pkg_bigarray,pkg_ctypes,\
    pkg_ctypes.foreign-base,pkg_ctypes.foreign,autolink,byte
+ ocamlc.opt -verbose -o tst -I /home/jeremy/.opam/4.01.0/lib/ctypes \
      /home/jeremy/.opam/4.01.0/lib/ocaml/unix.cma \
      /home/jeremy/.opam/4.01.0/lib/ocaml/bigarray.cma \
      /home/jeremy/.opam/4.01.0/lib/ctypes/ctypes.cma \
      /home/jeremy/.opam/4.01.0/lib/ctypes/ctypes-foreign-base.cma \
      /home/jeremy/.opam/4.01.0/lib/ctypes/ctypes-foreign-unthreaded.cma \
      tst.cmo

With -thread:

$ ocamlfind ocamlc -verbose -thread -linkpkg -package ctypes.foreign tst.cmo -o tst
Effective set of compiler predicates: pkg_unix,pkg_threads.posix,pkg_threads,pkg_bigarray,pkg_ctypes,\
    pkg_ctypes.foreign-base,pkg_ctypes.foreign,autolink,mt,mt_posix,byte
+ ocamlc.opt -verbose -o tst -thread -I /home/jeremy/.opam/4.01.0/lib/ctypes \
      /home/jeremy/.opam/4.01.0/lib/ocaml/unix.cma \
      /home/jeremy/.opam/4.01.0/lib/ocaml/threads/threads.cma \
      /home/jeremy/.opam/4.01.0/lib/ocaml/bigarray.cma \
      /home/jeremy/.opam/4.01.0/lib/ctypes/ctypes.cma \
      /home/jeremy/.opam/4.01.0/lib/ctypes/ctypes-foreign-base.cma \
      /home/jeremy/.opam/4.01.0/lib/ctypes/ctypes-foreign-threaded.cma \
      tst.cmo

yallop added a commit that referenced this pull request Oct 29, 2013
@yallop yallop merged commit 37359c1 into yallop:master Oct 29, 2013
@yallop yallop deleted the optional-threading-support branch October 29, 2013 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant