Page 1 of 1

Import Lib difference between 32 and 64 bit?

Posted: Tue Jun 11, 2013 3:31 pm
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

Re: Import Lib difference between 32 and 64 bit?

Posted: Thu Jun 13, 2013 3:08 pm
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

Re: Import Lib difference between 32 and 64 bit?

Posted: Thu Jun 13, 2013 3:20 pm
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

Re: Import Lib difference between 32 and 64 bit?

Posted: Thu Jun 13, 2013 3:56 pm
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.

Re: Import Lib difference between 32 and 64 bit?

Posted: Thu Jun 13, 2013 5:45 pm
by Kukulkan
Thank you! This explains it so far. So best I do my own .lib for including?