caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Dumb question on bytecode compiler
@ 2003-06-16 15:10 John Skaller
  2003-06-17 12:26 ` Damien Doligez
  0 siblings, 1 reply; 2+ messages in thread
From: John Skaller @ 2003-06-16 15:10 UTC (permalink / raw)
  To: caml-list

This works fine with the optimising compiler:

ocamlopt.opt  -I src  -a -o src/flxlib.cmxa src/flx_version.cmx src/flx_getopt.cmx src/flx_util.cmx 
src/flx_mtypes.cmx src/flx_srcref.cmx src/flx_typing.cmx src/flx_exceptions.cmx src/flx_string.cmx 
src/flx_id.cmx src/flx_print.cmx src/flx_typing2.cmx src/flx_unify.cmx src/flx_charset.cmx 
src/flx_parse.cmx src/flx_keywords.cmx src/flx_lex.cmx src/flx_pretok.cmx src/flx_lex1.cmx 
src/flx_tok.cmx src/flx_parse_ctrl.cmx src/flx_dfa.cmx src/flx_pat.cmx src/flx_constfld.cmx 
src/flx_macro.cmx src/flx_desugar.cmx src/flx_mbind.cmx src/flx_symtab.cmx src/flx_lookup.cmx 
src/flx_bbind.cmx src/flx_use.cmx src/flx_name.cmx src/flx_cexpr.cmx src/flx_csubst.cmx 
src/flx_tgen.cmx src/flx_display.cmx src/flx_ogen.cmx src/flx_gen.cmx
ocamlopt.opt  -I src  -cclib "-Lsrc  -lnums" -o bin/flxl nums.cmxa unix.cmxa flxlib.cmxa flxl.cmx

The same code with automatically generated changes for the bytecode compiler
(not finished doing the changes yet though)

ocamlc.opt  -I src  -a -o src/flxlib.cma src/flx_version.cmo src/flx_getopt.cmo src/flx_util.cmo 
src/flx_mtypes.cmo src/flx_srcref.cmo src/flx_typing.cmo src/flx_exceptions.cmo src/flx_string.cmo 
src/flx_id.cmo src/flx_print.cmo src/flx_typing2.cmo src/flx_unify.cmo src/flx_charset.cmo 
src/flx_parse.cmo src/flx_keywords.cmo src/flx_lex.cmo src/flx_pretok.cmo src/flx_lex1.cmo 
src/flx_tok.cmo src/flx_parse_ctrl.cmo src/flx_dfa.cmo src/flx_pat.cmo src/flx_constfld.cmo 
src/flx_macro.cmo src/flx_desugar.cmo src/flx_mbind.cmo src/flx_symtab.cmo src/flx_lookup.cmo 
src/flx_bbind.cmo src/flx_use.cmo src/flx_name.cmo src/flx_cexpr.cmo src/flx_csubst.cmo 
src/flx_tgen.cmo src/flx_display.cmo src/flx_ogen.cmo src/flx_gen.cmo
ocamlc.opt  -I src  -cclib "-Lsrc  -lnums" -o bin/flxl nums.cma unix.cma flxlib.cma flxl.cmo

Error while linking src/flxlib.cma(Flx_lex):
Reference to undefined global `Flx_lex'

How can linking the module Flx_lex from file
'flx_lex' cause a reference to an undefined symbol
which is its own name?

[Yeah, I guess the -cclib stuff still needs fixing .. but I get the same
error without that stuff in the command ..]

[BTW: do I need to use  -custom to integrate nums and unix? Is
there a way to produce a platform independent system, of do I have at
least to build, on each platform, a runtime including nums and unix?]

Sorry for dumb questions: I've never use the bytecode compiler before.

FYI: the source for Flx_lex is generated by ocamllex.

-- 
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Dumb question on bytecode compiler
  2003-06-16 15:10 [Caml-list] Dumb question on bytecode compiler John Skaller
@ 2003-06-17 12:26 ` Damien Doligez
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Doligez @ 2003-06-17 12:26 UTC (permalink / raw)
  To: John Skaller; +Cc: caml-list

On Monday, June 16, 2003, at 05:10 PM, John Skaller wrote:

> Error while linking src/flxlib.cma(Flx_lex):
> Reference to undefined global `Flx_lex'

You have used a fully-qualified identifier of Flx_lex inside Flx_lex
itself (for example, Flx_lex.foobar).  This is a violation of the 
scoping
rules of O'Caml : the name of the current module is not visible inside
the body of the module itself.  The native-code linker doesn't notice 
because
it is restricted to a flat name space.

> FYI: the source for Flx_lex is generated by ocamllex.

The bug is in a part that you have written by hand.

-- Damien

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-17 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-16 15:10 [Caml-list] Dumb question on bytecode compiler John Skaller
2003-06-17 12:26 ` Damien Doligez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).