support DLLs on Windows#75
Draft
jll63 wants to merge 90 commits into
Draft
Conversation
Replace declspec(import/export) approach with method consolidation: - Remove detail::static_fn infrastructure - Revert fn to simple static method member (not via MAKE_STATICS) - In augment_methods(), group methods by type_id and collect overriders from all module copies into canonical method - Build dispatch tables once per unique method, not once per copy This avoids intrusive list manipulation during initialization while enabling correct dispatch table construction with shared method state across DLL boundaries. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Resolve deferred type IDs before consolidation (deferred_static_rtti) - Update test_custom_rtti to assign unique IDs to non-polymorphic types via non_polymorphic_static_type<T>() function-local counter, so method tag classes don't collapse to a single sentinel and trigger spurious ambiguous dispatch - Remove get_fn test from dynamic_loading: each module now has its own fn instance, so address equality no longer holds (the state is synchronized via consolidation at initialize time instead) All 77 tests pass. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add `meet` multi-method to test_dynamic_loading so the test exercises multiple methods and non-zero slots/strides — previously the test accidentally passed because the lone `speak` method got slot 0 (matching zero-initialized arrays in non-local module fns) - Rename `canonical_methods` → `local_methods` in augment_methods: the selected method_info isn't canonical in any global sense, it's just the one that happens to live in the module performing initialize() - After dispatch table build, copy slots_strides values from each local method_info to all other module copies. Each module's `fn` has its own slots_strides[] array and dispatch reads it directly, so every copy must hold the same values. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Iterating methods directly and skipping the self pointer is clearer than building a side map keyed by type_index. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Revert from signed int back to std::size_t. To distinguish polymorphic from non-polymorphic types, set the high bit (1 << (sizeof(size_t)*8-1)) in the non_polymorphic_static_type counter values. Polymorphic Animal/ Dog/Cat keep small positive values 1/2/3; method tag classes get values like 0x800...001, 0x800...002 — comfortably outside the 1..3 range used by type_name. Avoids the size mismatch warnings (C4312) that b2's W4/WX flags treat as errors on the int->const-void* reinterpret_cast path. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Policy state moved into registry_state, so stderr_output::os is now a deprecated alias and stream() returns the registry-backed stream. The library's own diagnostics still wrote to os, which broke warnings-as-errors builds (e.g. b2 with /WX). Route them through stream() and give the test's capture_output policy a stream() accessor. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
boost::dll resolves the relative library name against the working directory. Without WORKING_DIRECTORY, ctest ran the test from the binary tree where a stale boost_openmethod-shared.dll could be picked up, failing at load with ERROR_PROC_NOT_FOUND. Point it at $<TARGET_FILE_DIR:boost_openmethod-dynamic>, where the freshly-built DLL sits co-located with the exe. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move the policy-independent dispatch-table-construction algorithm (~1300 lines) from the doubly-nested template registry<Policies...>::compiler<Options...> into the non-template detail::generic_compiler, so it compiles once per TU instead of once per distinct registry type. This fixes the 32-bit MSVC (cl.exe, ~2GB VA space) C1060 "compiler out of heap space" error when test_compiler.cpp etc. defined multiple registries. Key changes: - Add abstract trace_sink with per-registry trace_sink_impl<Registry> virtual overrides (5 small virtuals per registry instead of hundreds of operator<< instantiations). - Move all algorithm member functions to detail::generic_compiler (now non- template): build_class_lattice, assign_slots, build_dispatch_tables, etc. Replace if constexpr(has_trace) with if(tr.on()) and has_option<n2216> with use_n2216. - Reduce registry<...>::compiler<> to a thin shim: resolve_classes, resolve_methods, ctor binding tr.sink to the concrete sink impl, and install_global_tables running policies then swapping dispatch_data into registry::state. - All changes confined to initialize.hpp. Remove test/Jamfile's <toolset>msvc-14.5,<address-model>32:<build>no skip now that 32-bit works. - Add trace_demo.cpp example: demonstrates dispatch/next/tracing with BOOST_OPENMETHOD_TRACE=1. Verified: MSVC 14.5 x86_64 full suite pass; MSVC 14.5 x86_32 full suite pass (C1060 gone); gcc 13.4 -Werror clean; trace output identical (byte-for-byte after address normalization). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Explicitly convert function pointer to std::uintptr_t in write_pf() instead of relying on implicit conversion through operator<<. This avoids the -Wmicrosoft-cast warning while using the same reinterpret_cast approach that ostdstream.hpp already uses for function pointer output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
An automated preview of the documentation is available at https://75.openmethod.prtest3.cppalliance.org/libs/openmethod/doc/html/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-06-13 19:06:01 UTC |
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.
No description provided.