-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cgen: fix windows hot reload #23350
cgen: fix windows hot reload #23350
Conversation
This PR will make D:\v\v\v\examples\hot_reload>v -live run message.v
OK reloads: 0 | Total reloads: 0 | Hello! Modify this message while the program is running.
OK reloads: 1869376609 | Total reloads: 544501614 | Hello! Modify this message while the program is running.
OK reloads: 1869376609 | Total reloads: 544501614 | Hello! Modify this message while the program is running.
OK reloads: 1869376609 | Total reloads: 544501614 | Hello! Modify this message while the program is running.
OK reloads: 1869376609 | Total reloads: 544501614 | Hello! Modify this message while the program is running. But it seems that the reload counter has some problem. |
Maybe we can do this access the
|
As the .dll will be compiled and reloaded, it is not suitable put the |
if C.g_live_info == 0 {
// When the current program is not compiled with -live, simply
// return a new empty struct LiveReloadInfo in order to prevent
// crashes. In this case, the background reloader thread is not
// started, and the structure LiveReloadInfo will not get updated.
// All its fields will be 0, but still safe to access.
unsafe { C.g_live_info = int(&LiveReloadInfo{}) }
}
return unsafe { &LiveReloadInfo(C.g_live_info) } This will generated a simplify code: if (g_live_info == 0) {
{ // Unsafe block
g_live_info =((int)(((v__live__LiveReloadInfo*)memdup(...}, sizeof(v__live__LiveReloadInfo)));
}
}
return ((v__live__LiveReloadInfo*)(g_live_info)); |
I see this overlaps most of everything from an old PR except https://github.com/vlang/v/pull/19621/files#diff-c8aafc93f5a132c1afb63f4c56a73731d8368f0076262fc9fe26a209661690b6 |
There are some similarities, but this PR fixes a much deeper problem, and in a more maintainable way. |
Fix issue #23214
Force generate
_vinit_caller
,_vcleanup_caller
, these are needed under Windows, because dl.open() / dl.close() will call them when loading/unloading shared dll.Huly®: V_0.6-21781