Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] <newbie> Debugging mixed ocaml-C code.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eric Stokes <eric.stokes@c...>
Subject: Re: [Caml-list] <newbie> Debugging mixed ocaml-C code.
On Jul 22, 2004, at 10:34 AM, Corey O'Connor wrote:

> I'm having some troubles wrapping my head around working with both C
> and Ocaml code in the same project. If anybody could answer some
> questions for me that'd be great. :-)
> How does ocamldebug behave with mixed ocaml-C code? Can I debug the C
> code within ocamldebug? Or does the C code have to be debugged
> separately from the OCaml code?

gdb should work with C code linked with Ocaml, you should be able to 
set a breakpoint
in a C function, and run the caml code which calls the function. I have 
also had good luck
with valgrind if you're on x86.

> Are there any caveats to using the interactive environment with mixed
> Ocaml-C code?

Not many. If your OS does not support dynamic linking, and/or you don't 
your glue module as a dynamic library then you will need to make a new 
toplevel environment. ocamlmktop -custom .... Other than that, and the 
fact that
C code is not type safe it is completely transparent.

> Thanks!
> -- 
> -Corey O'Connor
> -------------------
> To unsubscribe, mail Archives: 
> Bug reports: FAQ: 
> Beginner's list:

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: