Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » x64 compiling problems

This thread is locked; no one can reply to it. rss feed Print
x64 compiling problems
boulifb
Member #7,909
October 2006

Hello Allegro team,

I have a problem when compiling Allegro under Windows XP Pro x64 with Visual Studio 2005.

Here is the build log:
1>------ Build started: Project: Allegro, Configuration: Debug x64 ------
1>Compiling...
1>wwnd.c
1>..\..\..\src\win\wwnd.c(517) : error C2065: 'GWL_WNDPROC' : undeclared identifier
1>wdispsw.c
1>..\..\..\src\win\wdispsw.c(168) : error C2065: 'GWL_HINSTANCE' : undeclared identifier
1>wddovl.c
1>..\..\..\src\win\wddovl.c(323) : error C2065: 'GCL_HBRBACKGROUND' : undeclared identifier
1>Generating Code...
1>Build log was saved at "file://c:\allegro\build\msvc8\Allegro\x64\Debug\BuildLog.htm"
1>Allegro - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

It seems that SetWindowLong is obsolete and SetWindowLongPtr should be used instead according to this thread:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120608&SiteID=1

When looking at the WinUser.h file in the platform sdk, you have the following lines (starting at line 1597):
...
/*
* Window field offsets for GetWindowLong()
*/
#define GWL_WNDPROC (-4)
#define GWL_HINSTANCE (-6)
#define GWL_HWNDPARENT (-8)
#define GWL_STYLE (-16)
#define GWL_EXSTYLE (-20)
#define GWL_USERDATA (-21)
#define GWL_ID (-12)

#ifdef _WIN64

#undef GWL_WNDPROC
#undef GWL_HINSTANCE
#undef GWL_HWNDPARENT
#undef GWL_USERDATA

#endif /* _WIN64 */
...

So, when using GWL_WNDPROC, GWL_INSTANCE and GCL_HBRBACKGROUND macros with the SetWindowLong, GetForegroundWindow and SetClassLong functions under x64 (_WIN64 defined) there are compilation errors.

It would be nice to fix it.

Best regards.

Fred.

kazzmir
Member #1,786
December 2001
avatar

Can you provide a patch for it?

boulifb
Member #7,909
October 2006

No developper in the Allegro team has an x64 Windows installed? ???

Evert
Member #794
November 2000
avatar

We have developers with Windows installed? Since when?

I exagerate a bit, but if you have a fix, contribute it. It's much easier and faster to apply a submitted patch than to make the actual changes yourself.

However, I seem to remember that Allegro does not officially support 64 bit in Windows anyway, so getting it to work properly could actually be a bit more tricky than just this fix. If this has changed I've missed the discussion on the mailinglist, which I suppose is possible. If you feel up to making it work with 64 bits native in Windows, cool. It'll need to be done eventually.

Elias
Member #358
May 2000

Where in the Allegro sources is WinUser.h btw? I'm somewhat confused..

--
"Either help out or stop whining" - Evert

BAF
Member #2,981
December 2002
avatar

Quote:

When looking at the WinUser.h file in the platform sdk, you have the following lines (starting at line 1597):

Who is "you?" The platform SDK is made and distributed by Microsoft, and has nothing to do with the Allegro team.

boulifb
Member #7,909
October 2006

BAF: The lines I shown are in the WinUser.h source from the SDK. GWL_WNDPROC and other calls are indeed from MS but they are not available for x64 compiling: it's another set of constants. No need to bite when mentionning MS. This stupid dady's wa-war is not the purpose here (and drives me crazy): it's not even constructive and so stupid. After all, We're adults (I hope) and above this. There is no shame for having bugs in a library. I'm just reporting the problem. I'm a mac user but I use also Windows because I'm formerly a windows user.

By the way, I have fixed the Allegro sources for Windows XP x64 but I still have some linking problems. I'm trying to fix that. Then allegro will be able to compile in an Windows x64 environment.

After researches it seems there are problems with x64 linking.

I continue the investigations to make Allegro running on an x64 Windows.

Best regards.

Fred.

Evert
Member #794
November 2000
avatar

Quote:

Who is "you?"

Excuse me if I sound very harsh, but you should refresh your reading skills - especially when reading posts from someone not writing in their native language. I know the sentence is a bit ambiguous and I'd have said the same thing differently (actually replacing "you have" with "you see" will already remove the ambiguity), but "you" clearly means "you" - the person who has opened the file.

Quote:

No need to bite when mentionning MS. This stupid dady's wa-war is not the purpose here (and drives me crazy): it's not even constructive and so stupid. After all, We're adults (I hope) and above this.

Calm down. I've not seen anyone bashing Microsoft here, or even say something negative about them, so I'm not sure why you think someone is doing that.
It's rather annoying when people start lashing out when they assume you're bashing Microsoft when they think you've said something negative about them.

Quote:

There is no shame for having bugs in a library.

Technically, since Allegro was never designed to work on 64 bit Windows and is known not to work there, it isn't a bug. It could be considered a missing feature though.

Quote:

Then allegro will be able to compile in an Windows x64 environment.

After researches it seems there are problems with x64 linking.

If and when you get that fixed, be sure to submit a patch.

boulifb
Member #7,909
October 2006

Thanks Evert for restablish the original purpose of the topic.

I still continue the investigation for linking Allegro on x64.
It's not a shamed not to provide x64 support. Did I blamed anybody (did I?)
I understand that x64 is not supported, but if it can be done, it'll be an additional possibility for Allegro.

When done, be sure I'll ring the bell. But it's far from being easy. While sources are fixed, I still need to link and I'm not familiar with x64 compiling and linking. x64 is not that obvious. ;)

Best regards.

Fred.

Add-on: I can link and compile now. But it seems that when using the library, Allegro includes the al386vc.h file that contains x86 assembler lines. x86 assembler is beyond my knowledge. Unless someone can convert these x86 asm lines into x64 it should work. I can't go further for the moment in the investigations.
Best regards.
Fred.

Jakub Wasilewski
Member #3,653
June 2003
avatar

You can try using the C only version, which doesn't need the assembler files. If I recall correctly, you do that by specifying ALLEGRO_USE_C=1 to the makefile, but I'm not 100% sure.

---------------------------
[ ChristmasHack! | My games ] :::: One CSS to style them all, One Javascript to script them, / One HTML to bring them all and in the browser bind them / In the Land of Fantasy where Standards mean something.

Matt Smith
Member #783
November 2000

Jakub, not quite true. There are a few small inline funcs in al386vc.h which are used even in the C only build (which is what you have to use to build in Visual Studio anyway) These are in _asm{} blocks so work even without MASM installed.

A quick look at these funcs says that they are very x86. I'm afraid I don't know x64 so I can't help. I can tell you that there are many parts in Allegro that assume a 32 bit compiler & cpu, so I wouldn't bother compiling any Allegro 4.x as 64 bit. Wait for Allegro 5.0 if you really want 64 bits.

Elias
Member #358
May 2000

Not in general - under unix, Allegro is fully 64-bit compatible, and since quite some time (running debian-amd64 here myself).

--
"Either help out or stop whining" - Evert

Evert
Member #794
November 2000
avatar

As Elias said, the platform neutral code and the UNIX specific code work properly in 64 bit (I'm guessing the MacOS X code works in 64 bit too, but I don't know that from personal experience). Any problems there might be in the Windows port are Windows specific (running 64 bit linux here too).

4.2.2 should compile natively with MSVC, as a C-only library, right? It would be best to try to compiel that in 64 bit and fix problems it runs in to.

boulifb
Member #7,909
October 2006

Hi guys,

I have already compiled without ASM (ALLEGRO_NO_ASM).
It seems that I have compiled the program that uses allegro without ALLEGRO_NO_ASM.

I was about to solve the problem.... and guess what happened...
Windows was down... I'm dumb!... That's why I prefere Unix' world :p

So, I have to reinstall a new x64 Windows XP and VS 2005. I'll do that next week end and give you news.

Thanks for the hand shots.

I'll send the modifications to do to compile in x64 for Windows.

After the investigations here are the points to modify in the windows' part to compile in x64 environment.

Actually there are 3 libs to add in the input part of the linker to link all. Because some runtime functions are linked in other libs. Don't ask me why, it's MS' decision. ;) I forgot those names, but I will refind them when the x64 environment will be back.

For fixing the sources, you need to use GWLP_xxx in x64 instead of GWL_xxx (for x86). A macro should do the work.

Fred.

Go to: