On Tuesday 09 June 2026 15:47:39 LIU Hao wrote:
> 在 2026-5-30 23:43, Pali Rohár 写道:
> > If there is a def file "lib1.def" with line "func1" and gendef was called
> > on lib2.dll which contains func2 symbol defined as PE forward to lib1.func1
> > then gendef produces "lib2.def" file with line "func2@0 = lib1.func1" even
> > when gendef was not called with -a option.
> > 
> > This behavior is wrong because func1 in lib1.def is not defined as stdcall
> > therefore gendef should not add stdcall decoration for func2.
> > 
> > This change fixes this issue, changes the way how gendef reads and parse
> > input def files.
> > ---
> >   mingw-w64-tools/gendef/src/gendef.c     |  5 ++++-
> >   mingw-w64-tools/gendef/src/gendef_def.c | 22 ++++++++++++++++------
> >   2 files changed, 20 insertions(+), 7 deletions(-)
> 
> 
> > diff --git a/mingw-w64-tools/gendef/src/gendef_def.c 
> > b/mingw-w64-tools/gendef/src/gendef_def.c
> > index 3dc33b805ee4..fdecf3b3582d 100644
> > --- a/mingw-w64-tools/gendef/src/gendef_def.c
> > +++ b/mingw-w64-tools/gendef/src/gendef_def.c
> > @@ -99,10 +99,18 @@ gendef_getsymbol_info (const char *dllname, const char 
> > *symbolname, int *isData,
> >         t++;
> >       if (t && strncmp (t, symbolname, symlen) == 0)
> >         {
> > -         if ((t[symlen] > 0 && t[symlen] <= 0x20) || t[symlen] == '@')
> > +         if ((t[symlen] >= 0 && t[symlen] <= 0x20) || t[symlen] == '@')
> >             {
> > -             t += symlen + 1;
> > -             *at = get_uint32_by_str (t);
> > +             *at = -1;
> > +             t += symlen;
> > +             if (t[symlen] == '@')
> 
> Looks like this should be `if (*t == '@')`?

Really. Good catch.
Now I'm just thinking how it could work for all def files which I
generated locally with this change.
So for now, please postpone this change. I really need to recheck this
and write new tests for confirming what it is doing.
At least the test scenario written in commit message is producing wrong
def file when using latest version from git.


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to