Skip to content

Build engLib as a shared DLL with apLib statically absorbed #1598

Description

@stepmikhaylov

Summary

Build apLib as a static lib and engLib as a dynamic lib (engLib.dll + import lib), with apLib.lib linked into engLib.dll. engine.exe, engtest.exe, and future C++ node DLLs link only engLib.dll — never apLib.lib directly. Result: one shared engine module that node DLLs import, with a single instance of all process-global state and, because there is only one dynamic module, one copy of every third-party dependency.

Why this layout

Avoids the vcpkg overlap of two DLLs: with a single dynamic module, deps used by both cores (e.g. OpenSSL — direct in apLib, transitive via aws/azure/cpprest in engLib) are linked once into engLib.dll instead of duplicated. No per-port dynamic triplet overrides, and no CMake-target merge — apLib.lib builds separately and is absorbed. aptest keeps linking apLib.lib standalone, so it stays lean.

Scope

  • engLibSHARED; apLib stays STATIC, linked privately into engLib.dll (absorbed). Ensure engine/engtest/node DLLs link engLib.dll only and never static-link apLib.lib — otherwise apLib, its deps, and the Factory registry duplicate per consumer. Update the prebuilt-lib path accordingly.
  • Single-instance globals: de-inline the header-defined Meyers singletons — starting with Factory::factories() (apLib/factory/Factory.h) — into a .cpp compiled once and exported; audit logger/allocator/other mutable header statics likewise.
  • Explicit cross-platform export policy (public API only): the exported surface spans both apLib and engLib (apLib lives inside engLib.dll), so apLib compiles in "export" mode. Hidden-by-default visibility + one dllexport/dllimport ↔ visibility("default") macro, modeled on CLASSIFY_API (include/classify_api.h). Don't rely on platform defaults (WINDOWS_EXPORT_ALL_SYMBOLS skips data symbols).
  • Reconcile PCH reuse (engine REUSE_FROM engLib) with the export/import switch.

Acceptance

engine.exe, engtest.exe, and aptest build, link, and pass the existing test suite against engLib.dll (apLib absorbed). Final proof that a second in-process module shares the one registry lands with the node POC in #1577.

Out of scope

The node loader, initializeNode contract, and the C++ node itself — those remain in #1577.

Parent

Part of #1577 (C++ node).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions