title: Is it possible to call into C functions from OCaml, without wrapped types?
body: <p>I'm trying to write a (desperately tiny, simple — I have no idea what I'm doing, let's be real!) compiler in OCaml.</p>
  
  <p>I'd really like to avoid checking <em>any</em> ISO-C code into the project (despite knowing C fairly well; the goal here is to learn and use OCaml exclusively.) Pursuant to this, I need to write a “runtime” for the compiled language in OCaml, compile it separately from the primary project, and then link it against the compiler-itself's output.</p>
  
  <p>Unfortunately, it looks like <em>any</em> external functions — even ones that don't touch any OCaml data-structures / the OCaml heap, are expected to be constructed using OCaml's C macros:</p>
  
  <pre><code>CAMLprim value scheme_entry(value unit) {
      int i;
      i = 42;
      return Val_int(i);
  }
  </code></pre>
  
  <p>This probably isn't an option, if I'm emitting the assembly instructions myself. (At least, not until I learn quite a bit more!)</p>
  
  <p>Is there <em>any</em> way (including hacky ones — this is a personal learning project) to invoke extremely simple functions like the following from OCaml?</p>
  
  <pre><code>_scheme_entry:
      movl $42 %eax
      ret
  </code></pre>
  
  <blockquote>
    <p>For reference, I'm working through Ghuloum's IACC: <a href="http://ell.io/tt$ocameel" rel="nofollow noreferrer">http://ell.io/tt$ocameel</a></p>
  </blockquote>