|
| 1 | +<html> |
| 2 | +<head> |
| 3 | +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 4 | +<title>Module Support (Experimental)</title> |
| 5 | +<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> |
| 6 | +<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> |
| 7 | +<link rel="home" href="../index.html" title="Boost.Regex 7.0.1"> |
| 8 | +<link rel="up" href="../index.html" title="Boost.Regex 7.0.1"> |
| 9 | +<link rel="prev" href="install.html" title="Building and Installing the Library"> |
| 10 | +<link rel="next" href="intro.html" title="Introduction and Overview"> |
| 11 | +<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 12 | +</head> |
| 13 | +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| 14 | +<table cellpadding="2" width="100%"><tr> |
| 15 | +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> |
| 16 | +<td align="center"><a href="../../../../../index.html">Home</a></td> |
| 17 | +<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> |
| 18 | +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> |
| 19 | +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> |
| 20 | +<td align="center"><a href="../../../../../more/index.htm">More</a></td> |
| 21 | +</tr></table> |
| 22 | +<hr> |
| 23 | +<div class="spirit-nav"> |
| 24 | +<a accesskey="p" href="install.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="intro.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> |
| 25 | +</div> |
| 26 | +<div class="section"> |
| 27 | +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> |
| 28 | +<a name="boost_regex.modules"></a><a class="link" href="modules.html" title="Module Support (Experimental)">Module Support (Experimental)</a> |
| 29 | +</h2></div></div></div> |
| 30 | +<p> |
| 31 | + This library has experimental support for C++ modules (C++20 or later), currently |
| 32 | + the support is experimental not least because at the time of writing (2025) |
| 33 | + build tools have yet to catch up with module support. |
| 34 | + </p> |
| 35 | +<p> |
| 36 | + In order to use this library as a module you simply add a: |
| 37 | + </p> |
| 38 | +<pre class="programlisting"><span class="identifier">import</span> <span class="identifier">boost</span><span class="special">.</span><span class="identifier">regex</span><span class="special">;</span> |
| 39 | +</pre> |
| 40 | +<p> |
| 41 | + to your code. |
| 42 | + </p> |
| 43 | +<p> |
| 44 | + Before that you must first build the module, which consists of these steps: |
| 45 | + </p> |
| 46 | +<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> |
| 47 | +<li class="listitem"> |
| 48 | + Depending on your compiler, you may need to build the standard library |
| 49 | + module, and place the standard module somewhere that your compiler can |
| 50 | + find it. |
| 51 | + </li> |
| 52 | +<li class="listitem"> |
| 53 | + Build <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">regex</span><span class="special">/</span><span class="identifier">module</span><span class="special">/</span><span class="identifier">regex</span><span class="special">.</span><span class="identifier">cxx</span></code> into the boost.regex module, and |
| 54 | + place the module definition file somewhere that your compiler can find |
| 55 | + it. |
| 56 | + </li> |
| 57 | +<li class="listitem"> |
| 58 | + Build all the source files in <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">regex</span><span class="special">/</span><span class="identifier">module</span></code> |
| 59 | + (including regex.cxx) into a library, and place the result somewhere your |
| 60 | + linker can find it. |
| 61 | + </li> |
| 62 | +</ul></div> |
| 63 | +<p> |
| 64 | + Visual studio users can simplify all of the above into one step, by placing |
| 65 | + everything in <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">regex</span><span class="special">/</span><span class="identifier">module</span></code> |
| 66 | + into a static library project, and then adding the <code class="computeroutput"><span class="special">/</span><span class="identifier">interface</span></code> command line option to the regex.cxx |
| 67 | + source file. |
| 68 | + </p> |
| 69 | +<p> |
| 70 | + Known limitations: |
| 71 | + </p> |
| 72 | +<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> |
| 73 | +<li class="listitem"> |
| 74 | + As of the start of 2025, only very recent versions of clang and msvc are |
| 75 | + supported. GCC is definitely not supported. |
| 76 | + </li> |
| 77 | +<li class="listitem"> |
| 78 | + The regex library must always be consumed via <code class="computeroutput"><span class="identifier">import</span> |
| 79 | + <span class="identifier">boost</span><span class="special">.</span><span class="identifier">regex</span><span class="special">;</span></code> |
| 80 | + and you can never mix this with <code class="computeroutput"><span class="preprocessor">#includes</span> |
| 81 | + <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">regex</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>. |
| 82 | + </li> |
| 83 | +<li class="listitem"> |
| 84 | + Ideally the standard library should always be used via <code class="computeroutput"><span class="identifier">import</span> |
| 85 | + <span class="identifier">std</span></code> and not via #includes: more |
| 86 | + recent compilers are mostly making this work, but are still very fragile. |
| 87 | + </li> |
| 88 | +<li class="listitem"> |
| 89 | + The regex version imported, is always the "standalone" version |
| 90 | + which includes no other Boost headers. |
| 91 | + </li> |
| 92 | +</ul></div> |
| 93 | +<p> |
| 94 | + Finally... there are some build and test scripts in <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">regex</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">module</span></code> |
| 95 | + for msvc and clang. |
| 96 | + </p> |
| 97 | +</div> |
| 98 | +<div class="copyright-footer">Copyright © 1998-2013 John Maddock<p> |
| 99 | + Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 100 | + file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) |
| 101 | + </p> |
| 102 | +</div> |
| 103 | +<hr> |
| 104 | +<div class="spirit-nav"> |
| 105 | +<a accesskey="p" href="install.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="intro.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> |
| 106 | +</div> |
| 107 | +</body> |
| 108 | +</html> |
0 commit comments