{"id":13731101,"url":"https://github.com/septag/libdhcore","last_synced_at":"2025-07-13T21:32:02.328Z","repository":{"id":149955130,"uuid":"20693020","full_name":"septag/libdhcore","owner":"septag","description":"Lightweight, performance oriented, Core library for 'C' programmers","archived":false,"fork":false,"pushed_at":"2015-08-10T10:27:36.000Z","size":895,"stargazers_count":53,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-14T21:38:23.824Z","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":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/septag.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}},"created_at":"2014-06-10T16:35:39.000Z","updated_at":"2023-07-23T01:43:30.000Z","dependencies_parsed_at":"2023-04-03T09:59:49.482Z","dependency_job_id":null,"html_url":"https://github.com/septag/libdhcore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/septag%2Flibdhcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/septag%2Flibdhcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/septag%2Flibdhcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/septag%2Flibdhcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/septag","download_url":"https://codeload.github.com/septag/libdhcore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225919918,"owners_count":17545378,"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","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":"2024-08-03T02:01:23.882Z","updated_at":"2024-11-22T15:29:06.379Z","avatar_url":"https://github.com/septag.png","language":"C","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"## libdhcore: darkHAMMER Core 'C' library\n\nVersion 0.5.2-dev  \n[http://www.hmrengine.com](http://www.hmrengine.com)  \n[https://github.com/septag/libdhcore](https://github.com/septag/libdhcore)  \n\n### Description\n*libdhcore* is a lightweight and cross-platform C (C99) library with C++ wrappers, mainly targeted to game developers. It is used in *darkHAMMER* game engine, I don't know how mature it is, but it is being used and tested for 2 years in various projects.  \nIt can be built with GCC, MSVC and Clang compilers, on x86, x86-64 and ARM platforms, including windows, linux, MacOS and RaspberryPI.  \nSource code License is BSD.  \n\nHere's a list of library modules and their descriptions:  \n\n- **Memory manager**: Automatic leak detection, Memory ID tracing and stats (allocate by userId), with allocator and alignment support.\n- **Dynamic Array**: Fast C-friendly dynamic array container\n- **Color**: RGBA color type with common math functions\n- **Commander**: Command line argument parser and setup\n- **Crash manager**: Multi-platform crash handler and callstack report, with user definable callbacks on application crash\n- **Error manager**: Error handling functions, for keeping Error stack with reports\n- **File-IO**: File IO abstraction (memory and disk), with Virtual directory support, PAK files and automatic directory monitoring\n- **FreeList allocator**: Fixed size, dynamic malloc, freelist allocator for custom allocations\n- **Pool allocator**: Fast dynamic size, fixed malloc, pool allocator for custom memory allocations\n- **Stack allocator**: Very fast Stack based allocator for temperory custom memory allocations\n- **Hash tables**: Optimized Open, Closed and Chained Hash table implementations with Linear probing and support for custom allocators.\n- **Hash**: Murmur (32bit, 128bit, incremental) hashing functions\n- **Hardware Info**: Multi-platform CPU and memory information queries\n- **JSON**: JSON parser and writer, which is a thin wrapper over cJSON library with custom allocators\n- **Linked List**: Common C-style linked list\n- **Logging**: Formatted logging system, to different targets like console terminal, files and custom user functions.\n- **MT**: Cross-platform threading and Atomic functions, using Posix on unix derivatives and Win32 API on Windows.\n- **Sockets**: Sockets (UDP/TCP) wrapper functions\n- **Numeric**: Random numbers, and common numeric helper functions\n- **Pak files**: Compressed (or non-compressed) PAK file reading and writing.\n- **Primitives**: Rectangle, Sphere and AABB types with common mathematic functions\n- **Queue**: Common C-Style queue structure\n- **Stack**: Common C-Style stack structure\n- **JSON-RPC**: Flexible JSON-RPC parsing and responding, API signature control and help generation\n- **Standard math**: Common helper math functions\n- **Vector math**: Common SIMD optimized Vector math, Vector, Matrix and Quaternions (left-handed system)\n- **String helpers**: *libdhcore* doesn't provide string objects, but provides helper functions for common String and Path manipulations\n- **Task Manager**: Multi-threaded task dispatcher\n- **Timer**: High-Res OS timers\n- **Utility functions**: Common OS specific functions, copy, move, delete files, etc.\n- **Compresssion**: Thin layer over *miniz* library for data compression\n\n### Installation\n\n#### Linux/Waf\nInstall the packages listed below before proceeding to build and install the library :   \n\n- **git**: source control client (not required, as you can download the source too)\n- **python**: version 3 or higher, required in order to run the *waf* build system\n- **waf**: It also can be found in `libdhcore/var/waf` directory\n- **gcc**: Tested on version 4.8 \n\nAfter checking for above packages, run these commands, and change `/install/path` to your preferred path on disk (for example: `--prefix=/usr`) :\n\n```\ngit clone git@github.com:septag/libdhcore.git\ncd libdhcore\nwaf configure --prefix=/install/path\nwaf build\nsudo waf install\n```\n\nTo build debug libraries, which will have `-dbg` suffix after their names, use the commands below instead of last two lines:\n\n```\nwaf build_debug\nsudo waf install_debug\n```\n\nTo build test applications (*$(prefix)/bin/dhcore-test*) , use `--build-tests` argument in `waf configure`.   \n\nTo use a __Cross Compiler__, like for example compiling for RaspberryPI device, use `CC` and `CXX` enviroment variables, and `--platform` argument in *configure* and provide platform code for builder.  \nFor example, I have a ARMv6 cross compiler named *armv6-rpi-linux-gnueabi-gcc*, I use below command to configure the build for RaspberryPI device (under unix):\n\n```\nCC=armv6-rpi-linux-gnueabi-gcc CXX=armv6-rpi-linux-gnueabi-g++ waf configure --platform=linux_rpi\n```\n\nFor more *configure* options, run `waf --help` when you are in *libdhcore* directory to see more command line arguments.\n\n#### Linux/QtCreator\nThe code can also be built with Qt Creator. Fetch the code from _github_, open the project file `libdhcore.pro` and build.\n\n#### Windows/Visual Studio\nThere is also Visual Studio 2013 projects under `vs2013` folder. Open the solution. Choose your configuration and build.  \nThe code can also be built with _Qt Creator_. Just open the project file `libdhcore.pro` and build.\n\n#### MacOS/Xcode\nThere are xcode project files under `xcode` directory.  \nThe code can also be built with _Qt Creator_. Just open the project file `libdhcore.pro` and build.\n\n### Usage\nMake sure the you have setup *include* and *library* paths of *libdhcore* in your compiler. Then include any header file from `dhcore` directory into your source. And link your program to `dhcore`.  \n\nMain include file is `dhcore/core.h`, and before everything else you must *Initialize* core lib at the beginning of your program and *Release* it after everything else is done:  \n\n```\n#include \u003cstdio.h\u003e\n#include \"dhcore/core.h\"\n\nint main(int argc, char** argv)\n{\n    result_t r = core_init(CORE_INIT_ALL);\n    if (IS_FAIL(r))\n        exit(-1);\n\n    puts(\"Hello world\");\n\n    core_release(TRUE); // pass TRUE for leak report\n    return 0;\n}\n```\n\n#### C++ Wrappers\nSome data types have C++ wrappers, like containers (array, hashtable), allocators (freelist, stack, pool) and math primitives (vectors, matrix, geometric). So C++ programmers can use those and benefit from cleaner syntax and easier functionality. \n\n### Documentation\nFor API documentation (which is at it's early stage), check out this [API Documentation](http://www.hmrengine.com/docs/core/html).  \nYou can also build the documentation by installing **doxygen** and *cd* to `/path/to/libdhcore/doc` directory and run:  \n\n```\ndoxygen doxygen-core.conf\n```\n\nAfter that, HTML documentation will be ready at `doc/html` directory\n\n### Credits\n\n- **libdhcore**: Sepehr Taghdisian *(septag@github, sep.tagh@gmail)*\n- **cJSON**: [http://sourceforge.net/projects/cjson](http://sourceforge.net/projects/cjson)\n- **miniz**: [https://code.google.com/p/miniz](https://code.google.com/p/miniz)\n- **waf**: [https://code.google.com/p/waf](https://code.google.com/p/waf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseptag%2Flibdhcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseptag%2Flibdhcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseptag%2Flibdhcore/lists"}