Pelles C forum

C language => Beginner questions => Topic started by: Jean-Pierre Leroy on February 17, 2021, 10:46:21 AM

Title: Switching from Pelles C version 8 to version 10
Post by: Jean-Pierre Leroy on February 17, 2021, 10:46:21 AM
Dear all,

Until now I was using Pelles C compiler version 8 with an external library called Virtual Print Engine version 7.20 (Professional Edition 32 bit - licence); more on Virtual Print Engine here : https://www.idealsoftware.com/en/pdf-library/report-engine.html
 
Recently I've tested my C source codes with the latest version of Pelles C compiler version 10 and now I have this warning : (see also the enclosed screenshot).

POLINK: warning: Realigned section '.idata$2' in object 'vpep3272.lib(vpep3272.dll)' (from 4 to 1 byte(s)).

So I have some questions :

Q1. What is the importance of this warning ?
Q2. Is there a way to avoid this warning ?
Q3. Why I have this warning only with Pelles C version 10 ?
Q4. Do you think this warning could break something in the executable file ?

Thanks for your help.

Regards,
Jean-Pierre LEROY
Title: Re: Switching from Pelles C version 8 to version 10
Post by: Jean-Pierre Leroy on February 17, 2021, 06:37:02 PM
With Pelles C version 8.00.60 or Pelles C version 9.00.9 it works perfectly, I did not get the warning.
Title: Re: Switching from Pelles C version 8 to version 10
Post by: TimoVJL on February 18, 2021, 04:33:31 PM
If you create a new import library with polib for dll, warnings disappear ?
Title: Re: Switching from Pelles C version 8 to version 10
Post by: Jean-Pierre Leroy on February 18, 2021, 10:40:40 PM
I tried with a new import library made with polib for dll but I get many more errors:

POLINK: error: Unresolved external symbol '_VpePrintDoc@8' - referenced from 'E:\Projets\Pelles C 10 - App\ApplicationEtiquettesColisClients\output\FonctionsVPE.obj'.
Title: Re: Switching from Pelles C version 8 to version 10
Post by: frankie on February 19, 2021, 12:19:11 AM
The PE section '.idata$2' holds import table descriptors array. The section should be aligned on a 4 bytes boundary, the warning seem to advice that the import library arguably align the section on 1 byte boundary (the linker realigned the section on 1 byte boundary).
Not sure if this really lead to an access problem in the OS image loader, we have also consider that even if aligned on 1 byte boundary, maybe the first location, when loaded in memory, will be on a 4 bytes aligned address anyway by coincidence.
What exactly is the meaning of the warning isn't documented, or I haven't found it, and it would be fine if Pelle would explain the issue.
Anyway what isn't clear is: "Does the compiled code works?". If yes you can assume that there is no problem going on.
Title: Re: Switching from Pelles C version 8 to version 10
Post by: TimoVJL on February 19, 2021, 08:55:56 AM
Actually i meant a cleaning procedure for import library.
POLIB xxx.lib /MAKEDEF:xxx.def
after that in different location
POLIB /DEF:xxx.def /OUT:xxx.lib

Import library from 32-bit dll without decoration is just difficult
It is possible do it from polink error list, but only exported functions, not static ones.
Title: Re: Switching from Pelles C version 8 to version 10
Post by: Jean-Pierre Leroy on February 20, 2021, 09:49:34 PM
@TimoVJL : I followed the cleaning procedure, but then I've 7 warnings (see the screenshot)

@frankie : to answer your question "Does the compiled code works?". The answer is Yes the code works properly.

So maybe it is a question for Pelle : Is-it possible that this warning was not shown with POLINK.EXE provided with PellesC version 8 and 9 and that this warning is only detected with POLINK.EXE provided with PellesC Version 10 ?
Title: Re: Switching from Pelles C version 8 to version 10
Post by: Jean-Pierre Leroy on February 20, 2021, 10:16:40 PM
The situation is more clear for me now:

With PellesC Version 10 and POLINK.EXE provided with PellesC Version 10 : I get the warning and the code runs properly.
With PellesC Version 10 and POLINK.EXE provided with PellesC Version 9   : I didn't get the warning and the code runs properly.

So I suppose that POLINK.EXE has been improved with PellesC Version 10 and is now able to detect additional warnings that was not detected with earlier versions of POLINK.EXE. Pelle can you confirm ?

Thanks
Title: Re: Switching from Pelles C version 8 to version 10
Post by: TimoVJL on February 21, 2021, 10:09:51 AM
I forgot /MACHINE:x86 switch
I don't think that warning isn't harmful.
Title: Re: Switching from Pelles C version 8 to version 10
Post by: Pelle on February 21, 2021, 05:13:47 PM
The realigned warning was added to version 10. It was added because the alignments changed in POLINK (to account for X64 machines, among other things). This is an informational warning, unlike some other warnings, but there are no warning levels in POLINK and no way to disable a warning. I have no plans to change this.

The easy "fix" is to rebuild your import library with version 10.

The names in you screenshot contains decorated names for a 32-bit machines, but the default is now a 64-bit machine, so perhaps there is a mismatch somewhere...?
Title: Re: Switching from Pelles C version 8 to version 10
Post by: Jean-Pierre Leroy on February 21, 2021, 09:58:57 PM
Dear all,

I followed your advices and rebuild the import library with version 10 and the /MACHINE:x86 switch  (thanks to TimoVJL)

Code: [Select]
POLIB VPEP3272.lib /MAKEDEF:VPEP3272.def /MACHINE:x86
Then in a different location (thanks to TimoVJL)

Code: [Select]
POLIB /DEF:VPEP3272.def /OUT:VPEP3272.lib /MACHINE:x86
And now with new import library I didn't get anymore warning  :)

Thank you all for your help.