www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - hot reloading code gist

reply monkyyy <crazymonkyyy gmail.com> writes:
https://gist.github.com/crazymonkyyy/f3d40f5b7c0454bfaa118d5a73a3fe1c

dlopen is one of the functions not really documented in core, its 
api really sucks. This section of d could use some love.
May 15
next sibling parent reply "H. S. Teoh" <hsteoh qfbox.info> writes:
On Fri, May 16, 2025 at 01:03:46AM +0000, monkyyy via Digitalmars-d wrote:
 https://gist.github.com/crazymonkyyy/f3d40f5b7c0454bfaa118d5a73a3fe1c
 
 dlopen is one of the functions not really documented in core, its api
 really sucks. This section of d could use some love.
dlopen is a POSIX call. It sux because it's an OS C API, and there's nothing we can do about it. T -- Bomb technician: If I'm running, try to keep up.
May 15
parent reply Ogion <ogion.art gmail.com> writes:
On Friday, 16 May 2025 at 03:18:38 UTC, H. S. Teoh wrote:
 dlopen is a POSIX call.  It sux because it's an OS C API, and 
 there's nothing we can do about it.
We do have `core.runtime.Runtime.loadLibrary` that uses `dlopen`/`LoadLibrary` depending on platform. But for some reason there’s no wrapper for `dlsym`/`GetProcAddress`.
May 16
parent reply Hipreme <msnmancini hotmail.com> writes:
On Friday, 16 May 2025 at 08:37:34 UTC, Ogion wrote:
 On Friday, 16 May 2025 at 03:18:38 UTC, H. S. Teoh wrote:
 dlopen is a POSIX call.  It sux because it's an OS C API, and 
 there's nothing we can do about it.
We do have `core.runtime.Runtime.loadLibrary` that uses `dlopen`/`LoadLibrary` depending on platform. But for some reason there’s no wrapper for `dlsym`/`GetProcAddress`.
We have the libraray "bindbc-loader", which solves this exactly problem
May 30
next sibling parent reply monkyyy <crazymonkyyy gmail.com> writes:
On Friday, 30 May 2025 at 17:52:19 UTC, Hipreme wrote:
 On Friday, 16 May 2025 at 08:37:34 UTC, Ogion wrote:
 On Friday, 16 May 2025 at 03:18:38 UTC, H. S. Teoh wrote:
 dlopen is a POSIX call.  It sux because it's an OS C API, and 
 there's nothing we can do about it.
We do have `core.runtime.Runtime.loadLibrary` that uses `dlopen`/`LoadLibrary` depending on platform. But for some reason there’s no wrapper for `dlsym`/`GetProcAddress`.
We have the libraray "bindbc-loader", which solves this exactly problem
Hotloading local d code vs dymanic loading some big c lib probably are different problems.
May 30
next sibling parent Hipreme <msnmancini hotmail.com> writes:
On Friday, 30 May 2025 at 18:04:14 UTC, monkyyy wrote:
 On Friday, 30 May 2025 at 17:52:19 UTC, Hipreme wrote:
 On Friday, 16 May 2025 at 08:37:34 UTC, Ogion wrote:
 On Friday, 16 May 2025 at 03:18:38 UTC, H. S. Teoh wrote:
 dlopen is a POSIX call.  It sux because it's an OS C API, 
 and there's nothing we can do about it.
We do have `core.runtime.Runtime.loadLibrary` that uses `dlopen`/`LoadLibrary` depending on platform. But for some reason there’s no wrapper for `dlsym`/`GetProcAddress`.
We have the libraray "bindbc-loader", which solves this exactly problem
Hotloading local d code vs dymanic loading some big c lib probably are different problems.
They are exactly the same thing. The only other use-case I know, is that it is possible to hotload class code, which I don't use and never saw any project using. I've been hot reloading my code for more than 3 years now.
May 30
prev sibling parent reply xoxo <xororwr gmail.com> writes:
On Friday, 30 May 2025 at 18:04:14 UTC, monkyyy wrote:
 On Friday, 30 May 2025 at 17:52:19 UTC, Hipreme wrote:
 On Friday, 16 May 2025 at 08:37:34 UTC, Ogion wrote:
 On Friday, 16 May 2025 at 03:18:38 UTC, H. S. Teoh wrote:
 dlopen is a POSIX call.  It sux because it's an OS C API, 
 and there's nothing we can do about it.
We do have `core.runtime.Runtime.loadLibrary` that uses `dlopen`/`LoadLibrary` depending on platform. But for some reason there’s no wrapper for `dlsym`/`GetProcAddress`.
We have the libraray "bindbc-loader", which solves this exactly problem
Hotloading local d code vs dymanic loading some big c lib probably are different problems.
https://github.com/ddovod/jet-live This is for C++, but the logic is language agnostic, with some work, you could make it work for D, (strip the C++ compile part, and reuse the parsing and process patching patch). I've seen people make it work for Zig, this is much better than shared library reload, since the user has no build script to duplicate or code to separate. https://www.jakubkonka.com/2022/03/16/hcs-zig.html https://www.jakubkonka.com/2022/03/22/hcs-zig-part-two.html It's ARM in that example, but they plan to make it available for all the supported targets, built right in the compiler. The day they land that feature will be the day I switch.
May 30
parent monkyyy <crazymonkyyy gmail.com> writes:
On Saturday, 31 May 2025 at 06:29:03 UTC, xoxo wrote:
 https://github.com/ddovod/jet-live
A quick skim suggest they exploded the complexity budget. Im wondering if thats oo or c++ having much worse meta-programming then I previously believed I should probably try to do file watching tho.
May 31
prev sibling parent reply Ogi <ogion.art gmail.com> writes:
On Friday, 30 May 2025 at 17:52:19 UTC, Hipreme wrote:
 On Friday, 16 May 2025 at 08:37:34 UTC, Ogion wrote:
 We do have `core.runtime.Runtime.loadLibrary` that uses 
 `dlopen`/`LoadLibrary` depending on platform. But for some 
 reason there’s no wrapper for `dlsym`/`GetProcAddress`.
We have the libraray "bindbc-loader", which solves this exactly problem
I mean, this should be in the standard library.
Jun 08
parent monkyyy <crazymonkyyy gmail.com> writes:
On Sunday, 8 June 2025 at 09:53:15 UTC, Ogi wrote:
 On Friday, 30 May 2025 at 17:52:19 UTC, Hipreme wrote:
 On Friday, 16 May 2025 at 08:37:34 UTC, Ogion wrote:
 We do have `core.runtime.Runtime.loadLibrary` that uses 
 `dlopen`/`LoadLibrary` depending on platform. But for some 
 reason there’s no wrapper for `dlsym`/`GetProcAddress`.
We have the libraray "bindbc-loader", which solves this exactly problem
I mean, this should be in the standard library.
I dont imagine this execution model will survive phoboes styles opinions but heres a gist https://gist.github.com/crazymonkyyy/e6edc498376da0501c851c8c339eba4b
Jun 20
prev sibling parent monkyyy <crazymonkyyy gmail.com> writes:
On Friday, 16 May 2025 at 01:03:46 UTC, monkyyy wrote:
 https://gist.github.com/crazymonkyyy/f3d40f5b7c0454bfaa118d5a73a3fe1c

 dlopen is one of the functions not really documented in core, 
 its api really sucks. This section of d could use some love.
Id like to extend this to work with more then one function per file; whats a "good enough" target for api given that Im parsing code manually, or my previous experience with trying to grab functions from a module is just a mess.
May 30