I would add a third Elisp block that calls org-babel-tangle. Assuming all your code blocks execute on export that will make it tangle. Or I have also made an Elisp block that does the tangle and then runs the export command. I.e. Not using the keyboard shortcuts for export. 

On Thursday, September 24, 2015, Alan Schmitt <alan.schmitt@polytechnique.org> wrote:
Hello,

I have a question I feel is very basic but I did not find the answer in
the manual. How can I trigger the tangling of a block upon export.

More precisely, I want to give the following example in a lecture:

#+name:hello
#+begin_src ocaml :tangle myprog.ml
Printf.printf "Bonjour le monde !\n"
#+end_src

#+BEGIN_SRC sh :exports both :results verbatim
ocamlc -o myprog myprog.ml
./myprog
#+END_SRC

where I show a program to be compiled and actually compile it. Is there
a header I should put on the "hello" block to tangle it when I export
it?

Thanks,

Alan

--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated September 22, 2015, Mauna Loa Obs.): 397.77 ppm


--
John

-----------------------------------
Professor John Kitchin 
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu