Comments (3)
In fact, that is the issue. It is implementation dependent, there it's no well defined standard. So each linker may do different things. If you look at one of my samples, I have this case but with CR_STATE. I think I did had this issue and forgot writing about it. I think documenting and giving a option to disable .bss use would be the only way out.
See the "-fno-zero-initialized-in-bss" section here http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
from cr.
I think this shouldn't happen, unless the compiler and linker is doing something weird or unless I've forgot about something specific I did, which I doubt. It would require a bit more invesitgation to understand why this difference is happening.
The BSS is where zero-initialized static things are allocated, and I manage it because it basically:
- does not require any construction/initialization code to run when something new appears (a new non-initialized static variable is introduced in the code), it is always zeroed; and,
- is almost always safe to restore it, unless the code change was too intense - which was not the case most of the time in a rapid feedback cycle development;
We could really go into more control about everything, but that would almost require writing a dynamic linker for example, but then we have better and more expensive alternatives to cr :)
So, for my use case, I decided that the abusing BSS and CR_STATE is a good equilibrium between practicality, stability and effort required to get something usable.
On the other hand, we can introduce one option to disable managing BSS.
from cr.
yes, seems legit
But the the problem with windows vs other platforms inconsistency still persists. Here's how I reproduce it:
void update() {
static bool once = false;
if (!once) {
print_something();
once = true;
}
}
On windows, print_something()
runs everytime the plugin reloads, while on linux, it runs only the first time.
btw, should once
accounted as zero-initialized reside in .bss ?
from cr.
Related Issues (20)
- Issues with old plugin not unloading correctly. (TLS + Linux) HOT 15
- RFC: Re-loadable plugin callbacks and nested plugins. HOT 23
- Print errors outside of debug mode HOT 1
- Unable to rollback crash in first load of plugin HOT 8
- [Feature] Call any Function
- [Tutorial]Windows *.dll only Live Reload
- clang compile warnings HOT 1
- clang compile warning (trivial) HOT 1
- cr_main isn't invoked with operation CR_LOAD and the context passed to cr_plugin_load HOT 18
- Unknown pragmas
- Improve CI and range of compilers to test
- cr_pdb_process has unused arguments HOT 3
- multiple definition issue HOT 1
- Can't load plugins on linux HOT 2
- CR_LOAD called on first update, contrary to what the documentation states. Is this correct? HOT 2
- Crash protection prevents host crashes, causing application to freeze HOT 2
- AddressSanitizer reports an error when calling cr_plugin_close HOT 2
- Assert protection? HOT 10
- How to use this with Visual Studio? HOT 4
- Unable to build samples on Linux "Cannot specify link libraries for target "crTest" which is not built by this project" HOT 2
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 cr.