Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8978075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:31:19+00:00 2026-06-15T19:31:19+00:00

The Ocaml manual contains an exercise ( here ) in which library object files

  • 0

The Ocaml manual contains an exercise (here) in which library object files are loaded in the toplevel loop (the ocaml interactive interpreter) in the following way:

#load "dynlink.cma";;
#load "camlp4o.cma";;

I’m trying to replicate the subsequent code in a compilable source file, and the code requires the above library object files. Can I load these files with a line of code within the source file and compile it with ocamlc? I’ve tried “#load”, “load”, “#use”, “use”, “#require”, “require”, and all these proceded by “#directory” and “directory”. I know that you can include modules with “include ;;”, but this shouldn’t work either, because they’re just library files, not modules. I’ve tried to find a way to do this in the manual, but to no avail.

Do I need to reference the files in the compilation command? If so, how do I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:31:20+00:00Added an answer on June 15, 2026 at 7:31 pm

    I’m assuming your source is written using extensions implemented by camlp4o. To compile your source, you can say:

    ocamlc -pp camlp4o -o myfile myfile.ml
    

    I believe the complexities of the #load command are required only when you want to use the extensions in the toplevel (the interpreter).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I execute the following in OCaml's toplevel: #require num;; open Ratio;; ratio_of_int 2;;
I have a OCaml library with lots of classes I need some translator to
The OCaml standard library has a wonderful Set implementation that uses a very efficient
I'm starting learning Ocaml, using hickey book , and I'm stuck on Exercise 3.4,
An Ocaml interpreter app was put up on iTunes last November. I've done some
So I was reading http://www.podval.org/~sds/ocaml-sucks.html , which includes this quote (in the context of
Is in ocaml function which can parse string like this [(1,2,3);(1,2,5);(2,3,4)] into (int*int*int) list
I'm new to OCaml and attempting to implement List.append as a learning exercise. This
In Ocaml I'm struggling with subclassing and types: class super = object (self) method
in ocaml I am trying to write a function which takes as an argument

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.