[Ur] get c or object file from urweb compiler without -debug?

Adam Chlipala adamc at impredicative.com
Fri Jul 20 08:31:51 EDT 2012


Timothy Beyer wrote:
> I am writing a program that loads shared object files generated by Ur/Web
> dynamically at runtime, and I need either the .c or the .o files to generate
> the .so.
>
> I've already successfully generated the .so files, but the way that I currently
> obtain the object file (using -debug) seems messy.  What is the canonical way
> to obtain these files?
>
> The -debug switch appears to add the -g option to the c compiler options, which
> I don't want most of the time. (and also gives a warning if clang is used) When
> I read about the -dumpSource command, the documentation suggests that it is for
> stderr only.

The compiler is modularized to support exactly this sort of change to C 
compilation and linking.  You will want to do one or both of adding a 
new protocol at the SML level and creating a new C library to link.  See 
src/cgi.sml for an example of an SML-level protocol and src/c/cgi.c for 
an example of a C library that runs the resulting applications.

I know this is a brusque description.  I'm happy to answer more 
questions on the subject. :-)



More information about the Ur mailing list