Comments (3)
I've made some progress on this, but I'm a bit stuck. Basically, I have a loader module that is imported by stub.nim. The Loader spawns a thread that monitors the modification time on a helper dll. If the modification time is newer it unloads the old dll and loads the new dll. After loading the helper dll, I call its godot_gdnative_init and godot_nativescript_init to initialize things.
I've made the necessary modifications to the bindings and stub to get print working (I get output in the editor console), but when I try loading a module with a class created from gdobj (e.g. mainpanel.nim) in the helper an exception occurs when calling godot_nativescript_init.
I can't really think of another way to debug this unless I modify the generated c files from the godot-nim bindings to bisect the issue. Any clue what might be going on? Is there an easier way to debug this?
from godot-nim.
I got hot reloading working by using gdns as resources. It requires a modification to the Godot engine which I reference here: godotengine/godot#42449 (comment) The basic idea is that we need a Watcher node monitoring a Component. The component has two dlls: one is the safe dll and the other the hot dll. The hot dll is referenced in a gdns file as a sub resource so we're free to compile to the safe dll. In my scene the Watcher node checks the modification times of the Component's dlls and if the safe is newer than hot, destroys references to the Component. This triggers NativeScript for the Component to destruct engine side. The engine modification ensures that in NativeScriptLanguage::unregister_script, if no script is referencing the hot dll, the hot dll is terminated which releases the file lock on it. In the Watcher we can then write over the hot dll. And then we can go further by saving data before the reload, and restoring it after.
from godot-nim.
@endragor If you're interested I have a working framework for hot dll reloading. https://github.com/geekrelief/gdnim Not sure how feasible this is to integrate with godot-nim / godot-nim-stub because it relies on an engine modification, but I figured I'd share in case you're interested. So far I've only written some small components with it, but I don't see why it wouldn't scale.
from godot-nim.
Related Issues (20)
- Nim constructor not found for class BulletPhysicsDirectSpaceState HOT 1
- Issue with connecting signal BodyEntered (area) HOT 1
- Generate .dll for other platforms (like Linux) HOT 4
- New native extension system for 4.0 HOT 1
- Basis getEuler behavior
- Add proc directionTo for vector2 and vector3
- GDExtentions Support HOT 1
- Nake Build Error HOT 14
- Nake build failed if GODOT_BIN path contains space character
- How to deal with exceptions? (and other beginner notes) HOT 7
- Documentation search doesn't do anything
- Export questions HOT 2
- Is this abandoned? What's happening HOT 4
- nake build error:: type expected but got symbol 'Array' of kind 'enumField' HOT 2
- godot-nim crashing godot (windows 10) [Solved?]
- I can't find the answers
- Error: type expected, but got symbol 'Array' of kind 'enumField' HOT 1
- is this abandoned? HOT 7
- Output is flooding with `A foreign thread is created` when i use NavigationAgent
- Cant compile to wasm
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot-nim.