You can use the following ocamlopt flags to specify flags for compilation and linking:
-cc <comp> Use <comp> as the C compiler and linker -cclib <opt> Pass option <opt> to the C linker -ccopt <opt> Pass option <opt> to the C compiler and linker
As long as you know how to ask your C compiler to link the way you want, you can use these flags for this. In fact, I would suggest solving the problem in this order. First run it with the (trivial) C program, then do the following with ocamlopt.
Yes, you will need to install the library for the linker to execute it. In essence, you want your system to look like the target system (the one where you want your code to work). For suggestions on how to install the library on your system, I suggest asking a question on the forum dedicated to this system.
source share