From: jehenrik <jehenrik@yahoo.com>
To: caml-list@inria.fr
Subject: [Caml-list] how to add a primitive to Pervasives?
Date: Sat, 7 Sep 2002 18:33:56 -0400 [thread overview]
Message-ID: <E58150FD-C2B1-11D6-9EB4-00039375801A@yahoo.com> (raw)
Hi, I tried to hack with the sources to be able to turn on stack
backtracing in the toplevel. I realize I'm breaking the "no consumer
serviceable parts inside, breaking this seal will void warranty"
sticker, but I'd be happy if someone could explain to me why my approach
is not working.
Rather than being completely sure if it would work, I decided to try to
just write this function and add it to Pervasives:
CAMLprim value start_backtrace_c()
{
init_backtrace();
return Val_unit;
}
Judging by the function sys_exit, there are four other places that the
function apparently must be added to show up:
% grep -c -r sys_exit * |grep -v :0
boot/ocamlc:2
boot/ocamllex:1
byterun/main.c:1 // no this one is special for sys_exit
byterun/sys.c:1
byterun/sys.h:1
byterun/win32.c:1 // this too
otherlibs/threads/pervasives.ml:2
stdlib/pervasives.ml:2
So I add them all, in the obvious ways:
% grep -c -r start_backtrace * |grep -v :0
byterun/sys.c:1
byterun/sys.h:1
otherlibs/threads/pervasives.ml:2
stdlib/pervasives.ml:2
stdlib/pervasives.mli:1
During make, this causes various files like prim.c to be contain copies,
and everything seems to work until linking ocamlc fails:
boot/ocamlrun boot/ocamlc -I boot -o ocamlc utils/misc.cmo
utils/tbl.cmo utils/config.cmo utils/clflags.cmo utils/terminfo.cmo
utils/ccomp.cmo utils/warnings.cmo parsing/linenum.cmo
parsing/location.cmo parsing/longident.cmo parsing/syntaxerr.cmo
parsing/parser.cmo parsing/lexer.cmo parsing/parse.cmo
parsing/printast.cmo typing/ident.cmo typing/path.cmo
typing/primitive.cmo typing/types.cmo typing/btype.cmo typing/subst.cmo
typing/predef.cmo typing/datarepr.cmo typing/env.cmo
typing/typedtree.cmo typing/ctype.cmo typing/printtyp.cmo
typing/includeclass.cmo typing/mtype.cmo typing/includecore.cmo
typing/includemod.cmo typing/parmatch.cmo typing/typetexp.cmo
typing/typecore.cmo typing/typedecl.cmo typing/typeclass.cmo
typing/typemod.cmo bytecomp/lambda.cmo bytecomp/printlambda.cmo
bytecomp/typeopt.cmo bytecomp/switch.cmo bytecomp/matching.cmo
bytecomp/translobj.cmo bytecomp/translcore.cmo bytecomp/translclass.cmo
bytecomp/translmod.cmo bytecomp/simplif.cmo bytecomp/runtimedef.cmo
bytecomp/meta.cmo bytecomp/instruct.cmo bytecomp/bytegen.cmo
bytecomp/printinstr.cmo bytecomp/opcodes.cmo bytecomp/emitcode.cmo
bytecomp/bytesections.cmo bytecomp/dll.cmo bytecomp/symtable.cmo
bytecomp/bytelibrarian.cmo bytecomp/bytelink.cmo driver/errors.cmo
driver/compile.cmo driver/main_args.cmo driver/main.cmo
Error while linking boot/stdlib.cma(Pervasives):
The external function `start_backtrace_c' is not available
I also tried something similar putting a directive and an external in
toplevel/topdirs.ml, this time modeling after the external symbol
get_current_environment. But I have the same problem, I don't
understand how to cross over from the c symbol world to a caml
environment.:
boot/ocamlrun boot/ocamlc -I boot -linkall -o ocaml.tmp
toplevel/toplevellib.cma toplevel/topmain.cmo
Error while linking toplevel/toplevellib.cma(Topdirs):
The external function `init_backtrace' is not available
make: *** [ocaml] Error 2
Thanks again for tolerating my mucking around.
Jeff Henrikson
-------------------
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
reply other threads:[~2002-09-07 22:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E58150FD-C2B1-11D6-9EB4-00039375801A@yahoo.com \
--to=jehenrik@yahoo.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox