Win32::API port to 64-bits

brian_d_foy on 2009-02-05T04:42:00

I've been the current maintainer of Win32::API for some years now. I am proud to be working on such a useful module, at least for Windows people. I even managed once to build it under Linux/winegcc.

Lately, I've been receiving user requests about porting it to 64-bit architectures. While this is something I want to do, I might have some problems. Mainly, my lack of knowledge about porting 32-bit stuff to 64-bits under Windows. Luckily, there seems to be available information and enough interested users that can provide help, code, hardware and/or licenses.

So, if you are in any way interested in helping out or staying tuned on the 64-bit port of Win32::API, please join the libwin32 mailing list. I'm going to post some more details there.


x64 Perl

djberg96 on 2009-02-05T14:42:10

Is it even possible to build a 64 bit version of Perl on Windows? Ruby 1.8.x won't work because of inline assembler issues and I thought Perl (and probably others) would suffer from this as well:

http://msdn.microsoft.com/en-us/library/wbk4z78b.aspx

Re:x64 Perl

jand on 2009-02-05T19:55:51

Core Perl doesn't use inline-assembly, so this is not an issue. A 64-bit version of ActivePerl for Windows has been available since 2006.

Win32::API however does use inline-assembly and therefore needs to be changed to either move the assembly code into separate files to be processed by an assembler, or needs to use the new intrinsic functions in newer versions of VC++.

Feel free to join libwin32@perl.org to discuss the details. :)

Re:x64 Perl

tonyc on 2009-02-06T04:54:04

The calling conventions are also very different - Win32 uses a purely stack parameter passing convention, while x64 uses the standard amd64 parameter passing convention - with the first four parameters going into registers if possible.

For example:

GetTextFace(dc, sizeof(facename), facename)

compiles to:

; look Ma! No stack!
lea r8, OFFSET FLAT:facename
mov edx, 80 ; 00000050H
mov rcx, QWORD PTR dc
call QWORD PTR __imp_GetTextFaceA

Win32::API port to 64-bits

persicom on 2009-02-06T02:28:44

Ok, here's a stoooopid question: Shouldn't this project be writing Win64::API?

Re:Win32::API port to 64-bits

jand on 2009-02-06T02:41:54

No, it is called the "Win32 API for 64-bit Windows" even by Microsoft. Well, at least it was for a while, now I think it is just called the "Windows API".

Seriously, changing the module name would be very bad for writing portable scripts because you would then have to import different modules depending on the native size of your pointers. That's something you don't really care about at the Perl level.

Re:Win32::API port to 64-bits

persicom on 2009-02-06T03:28:42

Whoops. I forgot the smiley. As in:

Shouldn't this project be writing Win64::API? :-)