NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
api.h File Reference

NEOGRAPH_API export/import macro for shared-library builds. More...

#include <neograph/build_config.h>
Include dependency graph for api.h:

Go to the source code of this file.

Detailed Description

NEOGRAPH_API export/import macro for shared-library builds.

Public class and free-function declarations decorated with NEOGRAPH_API get the right linkage attribute on every supported platform:

  • When building a NeoGraph library (TU sees NEOGRAPH_BUILDING_LIBRARY): __declspec(dllexport) on Windows, visibility("default") on Linux/macOS.
  • When consuming a NeoGraph library (downstream binding / application): __declspec(dllimport) on Windows, no-op elsewhere.
  • Static builds on any platform: empty.

The CMake target machinery sets NEOGRAPH_BUILDING_LIBRARY (a target_compile_definitions PRIVATE on each neograph_* library) and NEOGRAPH_STATIC_BUILD (when BUILD_SHARED_LIBS is OFF). Component-specific macros also receive their owning target's private build definition.

Most engine libraries use the shared NEOGRAPH_API macro. Components whose public headers are intentionally consumed by another NeoGraph DLL may define a narrower macro below. MSVC eagerly emits helpers for exported classes, so treating those cross-DLL declarations as exports can create references to implementations owned by the wrong DLL.

Definition in file api.h.