Adventures in 64 bit land

I spent a some time last night trying to get JUCE to build for 64 bit Windows. The inline assembly would have to be replaced and a few other changes, but it’s pretty close.

I don’t have any pressing need to build 64-bit native Windows apps just yet, but it would be nice.

So I was curious - any thoughts on 64 bit support?


would be interesting to have a go, I guess. Fingers crossed it should all work, as I don’t think I’ve done anything like casting pointers to ints…

Longhorn is supposedly going to be both 32 bit and 64 bit on the same installation cd’s, so people with 64 bit cpu’s will get the 64 bit version installed… Just heads up…

I did see a few spots where pointers are cast to ints - you’ve got the 64-bit portability compiler warning "#pragma"ed off. There are a couple of places in the code where do it so you can check the alignment. These are all easy to clean up.

The only real architectural tweak I saw was that you have this type defined:

typedef int (MessageCallbackFunction) (void* userData);

A lot of the functions that are used as MessageCallbackFunctions return pointers for window handles or what have you. I was thinking that a good solution would be to define some JUCE-specific cross-platform type that corresponded to LONG_PTR and ULONG_PTR. Say, call it nint and nuint (native int), or whatever else you prefer.


typedef nint (MessageCallbackFunction) (void* userData);

would work nicely.

You can’t use in-line assembly with the AMD64 compiler. Even if you could, the current assembly is 32 bit code. Quite a bit of it could be replaced with either Windows API functions or with the new intrinsics that are available with Visual Studio 2005. The SSE stuff would have to be rewritten.

The other thing I found out was that building this stuff with VS 2003 is fairly painful. It’s much easier with VS 2005, but that’s only in beta. You could do it with the platform SDK and writing your own makefile, but that would be a fair amount of typing.

Visual Studio 6 will export a makefile from a .dsp file, but MS removed that feature from VS 2003. So I guess that would work if someone had VS 6.

oh bugger, I’d forgotten about those casts. I’ll have a look and do a few tweaks. Though I could have sworn I’d left the 64-bit warnings turned on…

The #pragma is in juce_PlatformDefs.h, line 54.

To clarify, this is nothing pressing. I have no urgent need to build native x64 apps anytime soon. I’m just planning ahead.

Thanks for checking it out, Jules.


Thanks. I’m not going to try 64-bit compiling myself right now, but I’ll clean those things up, as I should have done it in the first place.

I had very similar issues trying to compiler our WDM audio driver for 64 bit.

Hello Jules-

Thanks very much for making the changes for 64 bit support.


No problem. Let me know if you see anything else I could do with changing.