[m-dev.] proof-of-concept code for choosing a grade

Zoltan Somogyi zoltan.somogyi at runbox.com
Sun Dec 6 12:53:20 AEDT 2015



On Sun, 6 Dec 2015 12:23:32 +1100, Peter Wang <novalazy at gmail.com> wrote:
> > > > - The decision to do it in C.
> > > 
> > > It is not ideal for cross compiling.  We need to build the program with
> > > one C compiler to run on the building system, then with another C
> > > compiler to run on the system we are targeting.  We do already run into
> > > this issue in boehm_gc/Makefile.direct where (as a hack) we just assume
> > > 'cc' is usable to compile helper programs that run as part of the build
> > > process.  Something to be aware of.
> > 
> > I don't understand what "this issue" you are referring to. Is it the possibility
> > that the build machine and the target machine have different C compilers,
> > or the need for a C compiler at all? If the former, I don't see why
> > having the switch compilers from build to target should be a problem,
> 
> The former.  It's not a huge problem, but an extra complication that
> tends to be forgotten about.

I don't see how this is a problem for this application. The idea is that
there would be two .c files, say choose_grade_lib.c containing the
code for choosing a grade, and choose_grade.c as a wrapper around it
to turn it into a standalone program. There is nothing stopping those
two modules from being compiled by any C compiler you choose,
regardless of what C compiler you use for the rest of the Mercury system.
Specifically, there should be no problem whatsoever in compiling
this two-module program twice, with different compilers, for the host
machine and the target machine. The fact that choose_grade_lib.c
would also be bodily incorporated into the Mercury compiler,
via a foreign_code pragma or equivalent, has no bearing on this.

Zoltan.





More information about the developers mailing list