Hi Lailton,
I think some things have to be4 clarified.
There are two different places where source file names can be
stored.
One is for programing logic and allows to implement some of OOP
scopes
like MODULE FRIENDLY static functions and variables scope, module
width
variable declarations and the second is for debugger.
In the 1-st case when .prg files is compiled it mat include any
other ones
and code from them anyhow for compiler and HVM it is single module.
HVM recognizes such modules by their symbol tables. Each module has
its own symbol table. It's possible to attach file name to such
symbol table
though it may contain functions from different files. Harbour 3.2 do
that
but AFAIR Viktor removed this functionality from 3.4 branch to not
propagate such information to final users of binary code. In fact it
has
only
informative character and cannot be safely used in debugger.
HRB storage format was not designed to encapsulate such information
so HRB files do not contain module name. When HRB files is loaded at
runtime from the file the HRB filename is registered as module name.
When it's loaded from the memory buffer arbitrary name "pcode.hrb"
is used. ProcFile() PRG functions returns such name (if any).
The second case is support for debugger. As I said each function in
single module (obj/hrb) can come from different source file. To show
correct source file debugger needs to know it's exact name. To
resolve
this problem -b compiler switch is used. As result inside beginning
of
each function special PCODEs are added to pass on module names
and also local and static variable names to debugger. It doesn't
matter
how the PCODE is stored and compiled. HRB files and OBJ files
created
from C code generated with -gc, -gc2 or -gc3 contains such
information
and debugger can extract it. Anyhow please remember that runtime
environment can use different paths then compiler what can create
problems for relative paths. To resolve it debugger has option which
allow to set directories for source files. It greatly helps though
some
times is necessary to reload the file when program contains code
from files with the same name but different directories. Anyhow it
can be done though it slows done the debugging process.
best regards,
Przemek
W dniu 10.12.2025 o 23:20, Lailton
Fernando Mariano pisze:
Przemyslaw,
Can you provide an example how are you using this change with
hb_compileFromBuf?
I am using it with it:
cBuffer := hb_compileFromBuf( hb_memoRead( cDir + cFile ), .t.,
cFile, "-w", "-n2" , "-q2", "-es2" )
hb_hrbLoad( cBuffer )
inside main.prg used here I am using procFile() and it return
pcode.hrb and not the main.prg
Am I using it wrong?
I Noticied too that inside hb_hrbLoad the third argument is
exected to inform the file name is passed as NULL
maybe need some improve?