{"id":33003023,"url":"https://github.com/Celtoys/clReflect","last_synced_at":"2025-11-18T08:03:17.468Z","repository":{"id":46025932,"uuid":"45074219","full_name":"Celtoys/clReflect","owner":"Celtoys","description":"C++ Reflection using clang","archived":false,"fork":false,"pushed_at":"2023-05-10T22:57:15.000Z","size":116636,"stargazers_count":276,"open_issues_count":1,"forks_count":29,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-19T17:15:34.619Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Celtoys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS"}},"created_at":"2015-10-27T22:31:35.000Z","updated_at":"2024-11-20T08:10:21.000Z","dependencies_parsed_at":"2024-01-03T01:29:57.710Z","dependency_job_id":null,"html_url":"https://github.com/Celtoys/clReflect","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/Celtoys/clReflect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Celtoys%2FclReflect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Celtoys%2FclReflect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Celtoys%2FclReflect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Celtoys%2FclReflect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Celtoys","download_url":"https://codeload.github.com/Celtoys/clReflect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Celtoys%2FclReflect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285028340,"owners_count":27102545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-18T02:00:05.759Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-13T14:00:38.908Z","updated_at":"2025-11-18T08:03:17.463Z","avatar_url":"https://github.com/Celtoys.png","language":"C++","readme":"\r\nclReflect: C++ Reflection using clang\r\n=====================================\r\n\r\n- - - \r\n\r\nInstallation Instructions\r\n-------------------------\r\n\r\nThe executables in the \"bin\" directory can be run directly but require the [MSVC 2017 x86 redistributables](https://go.microsoft.com/fwlink/?LinkId=746571).\r\n\r\nQuick Tour\r\n----------\r\n\r\n[clReflectTest](https://github.com/Celtoys/clReflect/tree/master/src/clReflectTest) is an up-to-date test of the clReflect library, showing how to build a database and load it at runtime.\r\n\r\nC++ primitives are not reflected by default and need to be marked by `clcpp_reflect` Reflection Specs or using reflect attributes. More details can be found [here](https://github.com/Celtoys/clReflect/blob/master/doc/MarkingPrimitivesForReflection.md).\r\n\r\nFirst use `clscan` to parse your C++ files and output readable databases of type information:\r\n\r\n```\r\nclscan.exe test.cpp --output test.csv\r\n```\r\n\r\nEach of these databases can then be merged into one for your module using `clmerge`:\r\n\r\n```\r\nclmerge.exe output.csv input0.csv input1.csv input2.csv ...\r\n```\r\n\r\nFinally you can use `clexport` to convert this text database to a binary, memory-mapped database that can be quickly loaded by your C++ code:\r\n\r\n```\r\nclexport output.csv -cpp output.cppbin\r\n```\r\n\r\nThis will give you a runtime loadable database with two limitations:\r\n\r\n1. Functions and their parameters/return types will be reflected but their call address will not.\r\n2. You will have to use [clcpp::Database::GetType](https://github.com/Celtoys/clReflect/blob/master/inc/clcpp/clcpp.h#L885) in unison with [clcpp::Database::GetName](https://github.com/Celtoys/clReflect/blob/master/inc/clcpp/clcpp.h#L881) to get types at runtime instead of the more efficient [clcpp::GetType](https://github.com/Celtoys/clReflect/blob/master/inc/clcpp/clcpp.h#L934).\r\n\r\nMake sure you pay attention to all reported warnings and inspect all output log files if you suspect there is a problem!\r\n\r\nReflecting Function Addresses\r\n-----------------------------\r\n\r\nAll platforms support parsing the output of your compiler's MAP file and matching function address to their reflected equivalents in the database. Modify your `clexport` calls to achieve this:\r\n\r\n```\r\nclexport output.csv -cpp output.cppbin -map module.map\r\n```\r\n\r\nConstant-time, Stringless Type-of Operator\r\n------------------------------------------\r\n\r\nTo use the constant-time, stringless `GetType` and `GetTypeNameHash` functions you need to ask `clmerge` to generate their implementations for you:\r\n\r\n```\r\nclmerge.exe output.csv -cpp_codegen gengettype.cpp input0.csv input1.csv input2.csv ...\r\n```\r\n\r\nCompile and link this generated C++ file with the rest of your code, load your database, call the generated initialisation function to perform one-time setup and all features of clReflect are available to you.\r\n\r\nMatching your Compiler Settings\r\n-------------------------------\r\n\r\n`clscan` can forward compiler options to the underlying Clang compiler. Add `--` at the end of your `clscan` command-line and pass any options you want. For example, these are the advised command-line options for generating databases are Windows MSVC compatible:\r\n\r\n```\r\nclscan test.cpp --spec_log spec_log.txt --ast_log ast_log.txt --output test.csv -- \\\r\n-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D__clcpp_parse__ \\\r\n-fdiagnostics-format=msvc -fms-extensions -fms-compatibility -mms-bitfields -fdelayed-template-parsing -std=c++17 -fno-rtti\r\n```\r\n","funding_links":[],"categories":["Reflection"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCeltoys%2FclReflect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCeltoys%2FclReflect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCeltoys%2FclReflect/lists"}