https://github.com/SrMordred/reloaded Skip to content Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} SrMordred / reloaded Public * Notifications * Fork 3 * Star 22 A Simple DLang Live Code Reloading. License BSL-1.0 license 22 stars 3 forks Activity Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights SrMordred/reloaded This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 6 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/S] Use Git or checkout with SVN using the web URL. [gh repo clone SrMord] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit Git stats * 20 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .vscode crash return October 16, 2018 20:16 example Delete app.d~ November 19, 2018 03:37 source setjmp imports made public January 17, 2020 13:11 .gitignore upgrade to FileWatch 0.5 (solve #3 ) June 13, 2019 18:59 LICENSE license September 24, 2018 18:10 README.md removing nothrow October 17, 2018 17:56 dub.json upgrade to FileWatch 0.5 (solve #3 ) June 13, 2019 18:59 dub.selections.json upgrade to FileWatch 0.5 (solve #3 ) June 13, 2019 18:59 View code ReloadeD Show And Tell License README.md ReloadeD ReloadeD is a simple library for live code reloading based on dynamic libraries. ReloadeD is on experimental stage and have been tested only on windows. Show And Tell ReloadeD works with a simple Host application, and a Client Library. //HOST APPLICATION struct Data { int value; } void main() { import reloaded : Reloaded; import std.stdio : writeln; Reloaded script; Data userdata; /* Load the library, and pass the data that will be shared between HOST and CLIENT. */ script.load("path/lib.dll", userdata ); /* update() will call the method with same name at the client side and will reload the library when it changes automatically(and will call load()/unload() when necessary). */ //In case of client crash, code resumes from here. Optional mixin ReloadedCrashReturn; while(true) { script.update(); //see the data changed by the client here writeln(data); } } The client can be used with 5 functions: void init(void*) and void uninit(void*) Will be called on the first lib load and when the host is destroyed (or you change the lib path). It receive the userdata; void load(void*) and void unload(void*) Will be called once every time the client changes. It receive the userdata; void update() Can be called at will on the host side (normally inside a loop). ReloadeD will work even if you don't declare all possible functions. Note that you don't need ReloadeD module on the client side so you can reload dynamic libraries from any language :) mixin ReloadedCrashReturn; (Optional) This will create a returning point (using setjpm/longjmp) from where the program will resume if the code in the client side crash. //CLIENT LIBRARY import core.sys.windows.dll; import core.stdc.stdio : printf; mixin SimpleDllMain; extern(C): //Same struct declared on Host struct Data { int x; int y; } Data* userdata; void load( void* _userdata ) { printf("load\n"); //capture data coming from Host. userdata = cast(Data*) _userdata; } void unload(void* userdata){ printf("unload\n"); } void init(void* userdata){ printf("init\n"); } void uninit(void* userdata){ printf("uninit\n"); } void update() { //change value here, recompile and see the changes on the host side :) userdata.value = 10; } ReloadeD was inspired by cr.h. License Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. About A Simple DLang Live Code Reloading. Topics d dlang hot-reload Resources Readme License BSL-1.0 license Activity Stars 22 stars Watchers 3 watching Forks 3 forks Report repository Releases 6 tags Packages 0 No packages published Contributors 2 * * Languages * D 100.0% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.