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

Timothy Beyer beyert at fastmail.net
Fri Jul 20 21:11:13 EDT 2012


At Fri, 20 Jul 2012 08:31:51 -0400,
Adam Chlipala wrote:
> 
> 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. :-)
> 

Thanks Adam, that is very helpful.  I'll look into the protocol support on the
SML and C side.

My original plan was to just write a C FFI interface to load every .so
dynamically, but what you suggested looks like it should work with less effort
once I get it set up.

I'll bug the list again if I get stuck somewhere. :)

Regards,
Tim



More information about the Ur mailing list