Import Lib difference between 32 and 64 bit?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Kukulkan
Addict
Addict
Posts: 1422
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Import Lib difference between 32 and 64 bit?

Post by Kukulkan »

Hi,

I'm currently using such code compiling to 32 bit (Windows, Unicode):

Code: Select all

Import "version.lib"
GetFileVersionInfoSize( *lptstrFilename, *lpdwHandle ) As "_GetFileVersionInfoSizeW@8"
GetFileVersionInfo( *lptstrFilename, dwHandle, dwLen, *lpData) As "_GetFileVersionInfoW@16"
VerQueryValue( *pBlock, *lpSubBlock, *lplpBuffer, *puLen) As "_VerQueryValueW@16"
How come this does not work on 64 bit?

I found that the version.lib from 32 bit differs from 64 bit:
C:\Program Files (x86)\PureBasic5\PureLibraries\Windows\Libraries\version.lib
Function names beginning with underscore.

C:\Program Files\PureBasic5\PureLibraries\Windows\Libraries\version.lib
Function names not beginning with underscore.

Also, it only compiles on 64 bit if I leave the @ values away. But how does the 64 bit compiler now knowing the number of bytes for function parameters?

Thus, this one compiles for 64 bit (Windows, Unicode):

Code: Select all

Import "version.lib"
GetFileVersionInfoSize( *lptstrFilename, *lpdwHandle ) As "GetFileVersionInfoSizeW"
GetFileVersionInfo( *lptstrFilename, dwHandle, dwLen, *lpData) As "GetFileVersionInfoW"
VerQueryValue( *pBlock, *lpSubBlock, *lplpBuffer, *puLen) As "VerQueryValueW"
But why? I'm a little confused. Can somebody explain?

Best,

Kukulkan
User avatar
Kukulkan
Addict
Addict
Posts: 1422
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Import Lib difference between 32 and 64 bit?

Post by Kukulkan »

Hi,

can somebody please explain why the 64 bit import declaraion is so different? Any explanation? Or maybe I'm doing it wrong?

Kukulkan
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Import Lib difference between 32 and 64 bit?

Post by ts-soft »

This is by the developer. You can create your own import lib for version.dll or use this:
http://www.purebasic.fr/english/viewtop ... 48#p399748
or use polib direct with Flag /NOUND
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Fred
Administrator
Administrator
Posts: 18550
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Import Lib difference between 32 and 64 bit?

Post by Fred »

the '@xxx' notation is only used by Microsoft on x86, and it's not used at runtime. It's not the parameter number but just a convention (for example a double parameter will generate @8, and not @4). Basically, it's useless and has been removed in the x64 compilers from MS.
User avatar
Kukulkan
Addict
Addict
Posts: 1422
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Import Lib difference between 32 and 64 bit?

Post by Kukulkan »

Thank you! This explains it so far. So best I do my own .lib for including?
Post Reply