Farid Zaripov wrote:
-----Original Message-----
From: Martin Sebor [mailto:[EMAIL PROTECTED] Sent: Monday, July 09, 2007 9:54 PM
To: stdcxx-dev@incubator.apache.org
Subject: Re: Intel C++ build issues on Windows

I can make the function i.e. init_example() in which all needed hooks are installed, but this function should be invoked
from main()
in all examples.
I was hoping to do it in a non-intrusive way. For instance, on UNIX we could link with (or preload) a shared library that would in its startup code run the function. Or we could use a command line option to the preprocessor (such as gcc -include <file>) to include a header containing the definition of such a function:

http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Preprocessor-Optio
ns.html#index-include-634

Does MSVC have something similar?

  Yes. The MSVC have /FI option:
-------
Causes the preprocessor to process the specified header file.

That's good. Now we just need to look to see if all the other
compilers support something like it. Unfortunately, the first
two I looked at don't seem to have anything resembling it.

HP aCC:
  http://docs.hp.com/en/8759/options.htm#preproc
Sun C++:
  http://developers.sun.com/sunstudio/documentation/ss12/opts/index.html

So it looks like we need something different.

One possibility might be to create a copy of a standard file,
say <cstddef>, in examples/include and have it do what examples.h
does now in addition to #including the real <cstddef>. And of
course, we'd have to remember to explicitly #include <cstddef>
in every example to make it work.

Another option is to rig one of the library headers (e.g.,
_config.h) to optionally #include some header that we could
then "insert" by defining the right magic macro. Like this:

  // _defs.h
  #ifdef _RWSTD_INCLUDE_HEADER
  #  include _RWSTD_INCLUDE_HEADER
  #endif

then we'de compile our examples with the following option on
the command line:
-D_RWSTD_INCLUDE_HEADER=examples/include/include.h

Neither of these is very pretty but we have a feature request
for something pretty close to the second one:

  http://issues.apache.org/jira/browse/STDCXX-288

(We could do what Markus suggested with examples.h and have
the header #include config.h at the top.)

Thoughts?

Martin


/FI[ ]pathname
Remarks
This option has the same effect as specifying the file with double
quotation marks in an #include directive on the first line of every
source file specified on the command line, in the CL environment
variable, or in a command file. If you use multiple /FI options, files
are included in the order they are processed by CL.
-------

Farid.


Reply via email to