crosire / blink

A tool which allows you to edit source code of any MSVC C++ project live at runtime
BSD 2-Clause "Simplified" License
1.09k stars 81 forks source link

Ideas to make it language agnostic #44

Closed ryuukk closed 6 months ago

ryuukk commented 9 months ago

Hello,

Since it works on the obj level, i was wondering what it would take to make it language agnostic

What do you think would be needed to achieve it?

C:\dev\kdomz\zig-cache\o\05423ee6f5c0857d2386fe7c8a148e2e>blink.exe game.exe
Launching in target application ...
  Entry point was written to address 00007FF7DBAA0000
Reading PE import directory ...
Reading PE debug info directory ...
  Found program debug database: C:\dev\kdomz\zig-cache\o\05423ee6f5c0857d2386fe7c8a148e2e\game.pdb
  Found source file: C:\dev\kdomz\projects\c\nuklear\nuklear.c
  Found source file: C:\dev\kdomz\projects\c\glad\glad.c
  Found source file: C:\dev\kdomz\projects\c\mongoose\mongoose.c
Starting compiler process ...
  Started process with PID 2424
Starting file system watcher for 'C:\dev\kdomz\projects\c' ...
Starting file system watcher for 'C:\dev\kdomz\projects\c' ...
Starting file system watcher for 'C:\dev\kdomz\projects\c\mongoose' ...
Detected modification to: C:\dev\kdomz\projects\c\nuklear\nuklear.c
nuklear.c
Finished compiling "C:\dev\kdomz\projects\c\nuklear\nuklear.temp.obj" with code 0.
Unresolved external symbol 'fabs'.
./blink.exe game.exe
Launching in target application ...
  Entry point was written to address 00007FF769740000
Reading PE import directory ...
Reading PE debug info directory ...
  Found program debug database: C:\dev\kdom\bin\game.pdb
  Error: Could not determine source directories. Check your program debug database for source files.
The target application has exited with code 259.

Is a C source important? or is my assumption that it only need the object file correct?

If only the object file correct, could there be an option added to watch a specific file name

Would that work?

Thanks!

crosire commented 7 months ago

That should indeed work! Added a new option now for blink to watch modifications to object files, instead of looking for modifications to source files. That way it shouldn't matter what source language they came from (I tested with a MSVC project, but assume it works with other languages too). It also makes the requirements a bit lighter (don't need as much information in the PDB). Simply run: ./blink.exe --no-compile game.exe