English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Presicions on executable generation from caml: does ocamlopt -outpput-obj generates a main function ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-08-21 (12:13)
Subject: Presicions on executable generation from caml: does ocamlopt -outpput-obj generates a main function ?
Hello everyone,

I want to have some precisions concerning executable generation from an
ml file.

I am a bit accustomed with the ocamlc code generation.


The ml is compiled into a .cmo.

A C file is generated, embedding the cmo into a byte array which will be
passed to the function caml_startup


The main() function just calls the caml_startup() (or caml_main()).



My question is relevant to the ocamlopt generator.

When doing a -verbose, we see that there is no C file generated. The
.cmx is translated into assembly .asm, that in turn using ml.exe is
converted it into a .obj.

I don't know if in this case there is a main function which is defined
(inside the resulting .obj).


I am trying to build an executable which links to a library needing f2c
libs, libF77 and libI77. The first one needs to have a main function


When compiling with ocamlc, everything works fine, but switching to
ocamlopt yields the error message


libF77.lib(main.obj) : error LNK2019: unresolved external symbol _MAIN__
referenced in function _main


Thanks in advance for your help.

Any pointers to ocamlopt executable generation are welcome.



Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. 
Toute utilisation ou diffusion non autorisee est interdite. 
Tout message electronique est susceptible d'alteration. 
Societe Generale Asset Management et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. 
Decouvrez l'offre et les services de Societe Generale Asset Management sur le site www.sgam.fr 
This message and any attachments (the "message") are confidential and intended solely for the addressees. 
Any unauthorised use or dissemination is prohibited. 
E-mails are susceptible to alteration. 
Neither Societe Generale Asset Management nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. 
Find out more about Societe Generale Asset Management's proposal on www.sgam.com