samples/c_interface/*:
Replace left over references to the old c_header_code pragma.
Replace some uses of '__' as a module qualifier.
Replace tabs with spaces.
Add some missing words.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.
*/Makefile:
*/Mmakefile:
As above.
tests/hard_coded/.gitignore:
Don't ignore the purity subdir. This ignore must have been left over
from when purity.m was a test in hard_coded, not hard_coded/purity,
and it ignored an executable, not a directory.
samples/c_interface/standalone_c/Makefile:
samples/c_interface/standalone_c/c_main.c:
As above.
samples/c_interface/README:
s/C interface/foreign language interface/
Branches: main
Add two new options to the compiler for querying what flags are passed to the
C compiler at a finer level of detail than that provided by --output-cflags.
The first new option, --output-grade-defines, prints the flags passed to the C
compiler to define the macros that specify the current compilation grade.
The second new option, --output-c-include-dir-flags, prints the flags passed
to C compiler that tell it where to search for C header files.
The rationale for the addition of the new options is that when compiling C++ or
Objective-C programs that call exported Mercury procedures via a standalone
interface we need both the flags for the grade defines and the include search
directories but other flags that we usually pass the C compiler may not be
appropriate for either a C++ or Objective-C compiler.
compiler/options.m:
Recognise the new options.
compiler/mercury_compile.m:
Handle the new options.
compiler/compile_target_code.m:
Separate out the code that generates the grade macro define
flags into a separate predicate.
Do likewise with the code that generates the flags for specifying
C compiler include search directories.
doc/use_guide.texi:
Document the new options.
samples/c_interface/standalone_c/Makefile:
Illustrate how to use the new options when compiling a program that
uses a standalone interface. Explain why it may not be appropriate
to use the output of --output-cflags when compiling code that calls
exported Mercury procedures.
Branches: main
samples/c_interface/standalone_c/Makefile:
Delete comments regarding the mgnuc and ml scripts.
The example was changed so that it doesn't rely on those
some time ago.
set of flags that it passes to the linker in order to link against a
selected set of Mercury libraries (the standard libraries plus any others
specified via the --ml option) in the current grade.
This removes the need for using the ml script with standalone interfaces.
(Which is useful on those systems that don't have a proper shell and can't
use that script!)
compiler/compiler_target_code.m:
Add a predicate that prints out the above information.
Refactor code in order to to avoid duplication between the new
functionality and the existing code for invoking the linker.
compiler/mercury_compile.m:
compiler/options.m:
Add the new option.
doc/user_guide.texi:
Add an entry for the new option.
samples/c_interface/standalone_c/Makefile:
Query the compiler directly about what flags to pass to the linker
rather than using the ml script.
Query the compiler about what flags to pass to the C compiler as
well. (This was implemented a while ago, but this example was
never updated.)
Extend this example to optionally work with shared libraries.
Estimated hours taken: 0.2
Branches: main
Make it easier to build the stand-alone interface example in different grades.
samples/c_interface/standalone_c/Makefile:
Add a variable to set the option for setting the grade to build
the example in.
Estimated hours taken: 8
Branches: main
Add an example of how to use a stand-alone interface to the samples.
samples/c_interface/standalone_c/Makefile:
samples/c_interface/standalone_c/c_main.c:
samples/c_interface/standalone_c/c_main.exp:
samples/c_interface/standalone_c/mercury_lib.m:
New files. An annotated example of how to use a stand-alone interface.
samples/c_interface/README:
Mention the new example.