PDA

View Full Version : JEDI-SDL in Lazarus throwing a compile error in SDL_AddPixel



jasonf
21-03-2011, 01:03 PM
Hi Chaps, It's been a while since I was last here.. about 4 years (OMG Where has the time gone?)

I thought I'd try to recompile some of my old Delphi stuff in Lazarus - so I went about setting up the Jedi-SDL library and tried to compile and I'm getting an error..

I'm using the 64bit version of Lazarus - so I don't know if that's making a difference.
The JEDI-SDL library is the latest, unmodified, downloaded last night.

the error code is as follows:
C:\WINXP-C\CBCO\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas(466,11) Error: Typecast has different size (4 -> 8 ) in assignment
C:\WINXP-C\CBCO\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas(470,52) Hint: Converting the operands to "DWord" before doing the add could prevent overflow errors.
C:\WINXP-C\CBCO\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas(471,52) Hint: Converting the operands to "DWord" before doing the add could prevent overflow errors.
C:\WINXP-C\CBCO\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas(472,52) Hint: Converting the operands to "DWord" before doing the add could prevent overflow errors.
C:\WINXP-C\CBCO\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas(479,11) Warning: Conversion between ordinals and pointers is not portable


Any ideas?
My Compiler options are set up as follows:
-MDelphi -Scgi -O1 -g -gl -vewnhi -l -Fi..\..\..\..\CBCO\JEDI-SDLv1.0\ -Fi..\..\..\..\CBCO\JEDI-SDLv1.0\SDL\Pas\ -Fu..\..\..\..\CBCO\CBCFoundation\ -Fu..\..\..\..\CBCO\JEDI-SDLv1.0\ -Fu..\..\..\..\CBCO\JEDI-SDLv1.0\SDL\Pas\ -Fu..\..\..\..\CBCO\JEDI-SDLv1.0\SDL_Gfx\Pas\ -Fu..\..\..\..\CBCO\JEDI-SDLv1.0\SDL_Image\Pas\ -Fu..\..\..\..\CBCO\JEDI-SDLv1.0\SDL_Mixer\Pas\ -Fu..\..\..\..\CBCO\JEDI-SDLv1.0\SDL_Net\Pas\ -Fu..\..\..\..\CBCO\JEDI-SDLv1.0\SDL_Sound\Pas\ -Fu..\..\..\..\CBCO\JEDI-SDLv1.0\SDL_ttf\Pas\ -Fu..\..\..\..\CBCO\JEDI-SDLv1.0\SDLFilter\Pas\ -Fu..\..\..\..\CBCO\JEDI-SDLv1.0\SFont\Pas\ -Fu..\..\..\..\CBCO\JEDI-SDLv1.0\smpeg\Pas\ -Fu..\..\..\..\..\lazarus\lcl\units\x86_64-win64\ -Fu..\..\..\..\..\lazarus\lcl\units\x86_64-win64\win32\ -Fu..\..\..\..\..\lazarus\packager\units\x86_64-win64\ -Fu. -oAnomalous.exe -dLCL -dLCLwin32

WILL
21-03-2011, 08:27 PM
Hey welcome back Jason. :)

This is on Windows, yes? Dom has made some tiny revisions to allow do better Mac support since, but I'm unsure if it'll effect sdlutils or not. I'll PM you a copy of the unofficial (newer) copy he gave me. Maybe it'll help, but I'm unsure...

If that doesn't solve the issue, then I'd suggest just changing the function your using to work properly. It sounds like a typecasting issue and the unit it mentions is not actually an official SDL unit so you'd only be breaking the JEDI-SDL portion of the code's continuity, not the SDL portion.

JSoftware
21-03-2011, 09:20 PM
The problem is this line:


PUInt8( Addr )^ := R or G or B;


Addr is declared as:


Addr : cardinal;


And cardinal is a 32bit, which isn't going to work on a 64bit OS

Overall looking sdlutils.pas reveals some pretty bad code(bad in the sense it shouldn't be used for crossplatform use). Cardinal is used all over for pointer arithmetic. Unless it's given a large overhaul it won't work on anything but 32bit platforms

jasonf
22-03-2011, 12:28 PM
Thanks Guys.
There's totally some bad code in sdlutils, I wrote some of it LOL.

Yes it's Windows. The Mac is lovely, but all of my dev work is on Windows these days.

Unfortunately, My CBCFoundation engine uses it extensively (for better or for worse).

I'll download the 32bit version of Lazarus to see if that helps.

I should probably dump the CBCFoundation anyway in favour of an OpenGL based one - I'm too old to be writing Engines these days.

Thanks again.

code_glitch
22-03-2011, 09:24 PM
Yes it's Windows

Sorry, but I have to post a quick OUCH. I read you were using OpenGl, I'd watch some of it. Depending on the age of the setup you may find MS prefers D3D over OGL and it does show...

WILL
23-03-2011, 12:02 AM
Sorry, but I have to post a quick OUCH. I read you were using OpenGl, I'd watch some of it. Depending on the age of the setup you may find MS prefers D3D over OGL and it does show...
Easy doom-sayer. :) That would only be if they were using crappy drivers.

code_glitch
23-03-2011, 07:28 AM
But seriously, although I may not have had a total fail I cannot help noticing a 10fps speed difference on windows nonetheless so there is some truth to it in just about all instances unfortunately.