Repository navigation
Conversation
Changing one method of the API description makes everything that includes the monolithic generated C++ headers rebuild. splitclasses="true" on <implementation language="Cpp">: - writes <basename>_interface_<class>.hpp for every class, <basename>_interfaces.hpp stays as an umbrella header - new stubs include only the header of their own class splitclasses="true" on <binding language="CppDynamic">: - writes one header per class with the declarations only, and the method bodies, function table and polymorphic factory in a single source file, so the binding is no longer header-only: the source file has to be compiled and linked - no example is generated for this variant Without the attribute the generated output is unchanged. The attribute is documented in IDL.md and ACT.xsd. Build/build.sh and build.bat list the new source files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #243
What
Adds an optional boolean attribute
splitclasses(defaultfalse) to<implementation language="Cpp">and<binding language="CppDynamic">.Without it the generated output is unchanged.
Output with
splitclasses="true"Cpp implementation:
<base>_interface_<class>.hppper class<base>_interfaces_fwd.hpp(forward declarations)<base>_interfaces.hppas an umbrella headerCppDynamic binding:
<base>_dynamic_<class>.hppper class_fwd,_wrapperand_tableheaders and the<base>_dynamic.hppumbrella<base>_dynamic.cppwith the method bodies (it must be compiled andlinked). The function table is private to
CWrapper..hheader and no example applicationClass names
fwd,wrapperandtableare rejected by the CppDynamicbinding in split mode because they would clash with the helper headers.
Why
For large components a single IDL edit regenerates multi-megabyte files and
forces every translation unit that includes them to rebuild. In our component
(about 450 classes) a simple method change (editing one method description)
took about 23 minutes to rebuild. When the files are synced by content,
unchanged class headers keep their timestamps and only their includers
rebuild. The same edit now takes about 1:20.
Implementation notes
buildbindingccpp.gogets a style parameter(header-only or split) instead of a copy of the code. The split-specific
code is in
buildbindingccppsplit.goandbuildimplementationcppsplit.go.Documentation/IDL.mdandSource/ACT.xsd.build.shandbuild.batinclude the new source files.Testing
Before rebasing onto the current
develop:develop(comparedon a ~450-class component, an RTTI example, and the thread safety and
injection examples).
components.
CWrapper::*WrapperTablehelpers.After the rebase:
pre-rebase build on the ~450-class component.
libPrimes(which has a journal method) generates withsplitclassesonboth the binding and the implementation. MSVC compiles the generated
wrapper, journal and exception sources without errors.
Not tested: macOS and Linux compilers, running a split build at runtime
(including the journal output), and the byte-identity comparison against
developafter the rebase.