Compiling SDL with BCB...

Compiling SDL with BCB...

Post by Dominique Loui » Thu, 31 Jan 2002 21:00:39



Hi All,
   I am trying to compile the excellent SDL ( http://www.libsdl.org )
with BCB, as lots of people on the SDL mailing say that they have had
endless problems try. So being stubborn I thought I would look into it
even though I have very little BCB experience at this level. I converted
the Visual C++ workspaces to Borland Project groups and projects. I am
able to compile SDLMain.lib without any problems but when I try and
compile SDL.dll I get a "Too many errors and warning messages" error.

What could be causing this? Is there someone here who has 5-10 minutes
to spare to look at this problem. I really hate it when developers are
forced to use VC++ because the can't get BCB to do something which I am
sure it can do. I have been using SDL with Delphi/Kylix for nearly a
year now so I find it hard to believe that BCB would not be able to do
the same. It just seems a little more compilcated or am I missing
something here.

Anyway I hope someone can shed some light on the problem.

Thanks,

Dominique.

 
 
 

Compiling SDL with BCB...

Post by Corey Murtag » Fri, 01 Feb 2002 06:20:19


Hi Dominique,

Sounds to me like you're trying to rebuild SDL.  Any particular reason?

I tried it once myself, but those warnings got to me in the end.  I ended up
just generating a lib file from the DLL using implib, which seems to work
fine.  Then, in a fit of obvious stupidity, I wrote a module that loads and
links to the dll, with the ability to fail gracefully if an entry point is
missing.

Anyway, to get a lib you can link to your BCB app, try this:

implib sdl_bcb.lib sdl.dll

Assuming everything is in the path (add paths to the command if not) you
should get a lib file that dynamically links to sdl.dll.  Include it in your
app and the SDL should just work :)

--
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur."

 
 
 

Compiling SDL with BCB...

Post by Dominique Loui » Fri, 01 Feb 2002 07:41:35


Hi Corey,
   I wanted to build it because others had said they were having
problems. Also as BCB for Linux is coming out I thought it would be a
good opporunity to help those BCB game programmers go cross-platform.

So what is the purpose of the "lib" file?
In Delphi/Kylix all you need is the header file and a DLL and you are
able to access the functions in the DLL. And that is exactly how I have
used JEDI-SDL.
I thought that was what the *.h files were for.

2nd Question. Do I now need to include the "lib" file in any projects I
need or can I simple stick in a path somewhere.

Are you working on any SDL games/applications at the moment?

Thanks,

Dominique.


> Hi Dominique,

> Sounds to me like you're trying to rebuild SDL.  Any particular reason?

> I tried it once myself, but those warnings got to me in the end.  I ended up
> just generating a lib file from the DLL using implib, which seems to work
> fine.  Then, in a fit of obvious stupidity, I wrote a module that loads and
> links to the dll, with the ability to fail gracefully if an entry point is
> missing.

> Anyway, to get a lib you can link to your BCB app, try this:

> implib sdl_bcb.lib sdl.dll

> Assuming everything is in the path (add paths to the command if not) you
> should get a lib file that dynamically links to sdl.dll.  Include it in your
> app and the SDL should just work :)

> --
> Corey Murtagh
> The Electric Monk
> "Quidquid latine dictum sit, altum viditur."

 
 
 

Compiling SDL with BCB...

Post by Flavius Vespasianu » Fri, 01 Feb 2002 12:02:09




Quote:> Hi All,
>    I am trying to compile the excellent SDL ( http://www.libsdl.org )
> with BCB, as lots of people on the SDL mailing say that they have had
> endless problems try. So being stubborn I thought I would look into it
> even though I have very little BCB experience at this level. I converted
> the Visual C++ workspaces to Borland Project groups and projects. I am
> able to compile SDLMain.lib without any problems but when I try and
> compile SDL.dll I get a "Too many errors and warning messages" error.

Too many warnings will cause the compiler to abort. My guess is this is C
code that uses older constructs. Try removing the limit on the number of
warnings.
 
 
 

Compiling SDL with BCB...

Post by Corey Murtag » Fri, 01 Feb 2002 12:49:21



Quote:> Hi Corey,
>    I wanted to build it because others had said they were having
> problems. Also as BCB for Linux is coming out I thought it would be a
> good opporunity to help those BCB game programmers go cross-platform.

Will be interesting to see how BCB on Linux goes.  I'm definitely looking
forward to it :)

Quote:> So what is the purpose of the "lib" file?
> In Delphi/Kylix all you need is the header file and a DLL and you are
> able to access the functions in the DLL. And that is exactly how I have
> used JEDI-SDL.
> I thought that was what the *.h files were for.

The header files (*.h) describe the imported functions to the compiler, so
that it knows how to compile calls to them - parameters, return values,
calling convention, etc.

The lib file is a stub that loads the DLL and gets the various entry points
at runtime.  When you link to the DLL all of your calls to functions in the
DLL are linked to the LIB file, which passes them onto the DLL... if that's
not too confusing :)

Quote:> 2nd Question. Do I now need to include the "lib" file in any projects I
> need or can I simple stick in a path somewhere.

Yes, and no.  You can add the following line near the top of sdl.h:

#pragma link "sdl.lib"

Assuming you have sdl.lib in your linker path it'll add it to the project if
you've included sdl.h at any point.

As to why you have to do this with BCB when you don't with Delphi... here's
the definition for SDL_Init from SDL.par (JEDI-SQL):

function SDL_Init(flags: uint32): Integer; cdecl; external LibName;
{$EXTERNALSYM SDL_Init}

LibName is defined as either 'sdl.dll' or 'libSDL-1.1.so.0', depending on
platform.  This effectively does what the lib file does - creates an entry
point that's valid at link-time, so your functions can call it.  Since
there's no equivalent syntax in C++ for doing that, we use lib files.

Quote:> Are you working on any SDL games/applications at the moment?

Yup.  I could tell you what it is, but then I'd have to shoot you :)

Seriously though, I'm playing around with a few ideas I had for a
multi-player adventure/roleplaying game.  I'm using SDL for the client, and
probably for the server just for the platform-independant threading and
stuff.  I'd like to have both Linux and Win32 clients, and if I decide to
write a multi-shard server pool it'd be nice not to be restricted to one
platform.

--
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur."

 
 
 

Compiling SDL with BCB...

Post by Dominique Loui » Fri, 01 Feb 2002 20:26:44


Hi Corey,


> Will be interesting to see how BCB on Linux goes.  I'm definitely looking
> forward to it :)

So am I as I think the Linux community ( in theory ) should embrace it
more than they have Kylix.

Quote:> The header files (*.h) describe the imported functions to the compiler, so
> that it knows how to compile calls to them - parameters, return values,
> calling convention, etc.

> The lib file is a stub that loads the DLL and gets the various entry points
> at runtime.  When you link to the DLL all of your calls to functions in the
> DLL are linked to the LIB file, which passes them onto the DLL... if that's
> not too confusing :)

Ok that makes sense Now.

Quote:> As to why you have to do this with BCB when you don't with Delphi... here's
> the definition for SDL_Init from SDL.par (JEDI-SQL):

> function SDL_Init(flags: uint32): Integer; cdecl; external LibName;
> {$EXTERNALSYM SDL_Init}

> LibName is defined as either 'sdl.dll' or 'libSDL-1.1.so.0', depending on
> platform.  This effectively does what the lib file does - creates an entry
> point that's valid at link-time, so your functions can call it.  Since
> there's no equivalent syntax in C++ for doing that, we use lib files.

I am embarassed to say that I am the project leader on the JEDI-SDL
project but since my world has essentially been Delphi I did not really
think "outside the box". At least now I understand how C/C++ and Delphi
handle these type of things. So thanks for enlightening me.

Quote:>>Are you working on any SDL games/applications at the moment?

> Yup.  I could tell you what it is, but then I'd have to shoot you :)

> Seriously though, I'm playing around with a few ideas I had for a
> multi-player adventure/roleplaying game.  I'm using SDL for the client, and
> probably for the server just for the platform-independant threading and
> stuff.  I'd like to have both Linux and Win32 clients, and if I decide to
> write a multi-shard server pool it'd be nice not to be restricted to one
> platform.

Sounds quite interesting. Just FYI, one of the JEDI-SDL Demos is a 3D
network game called DeathTruckTion and instead of using SDL_Net for it's
cross-platform server code, it uses the excellent Indy components for
both Windows and Linux.

Thanks again for all the information. It is always good to learn
something new.

Now, if I have the time I will create some BCB projects for all the SDL
demos.

L8R,

Dominique
http://www.DelphiGamer.com := for all your Object Pascal game
development needs;

 
 
 

Compiling SDL with BCB...

Post by Jonathan Arnol » Sat, 02 Feb 2002 09:10:12


Quote:> Too many warnings will cause the compiler to abort. My guess is this is C
> code that uses older constructs. Try removing the limit on the number of
> warnings.

Or add a command line flag to suppress the warnings. -w-XXXX where XXXX is
the number of the warning.

--
Jonathan Arnold         C/C++/CBuilder Keen Advice:
http://www.keen.com/categories/categorylist_expand.asp?sid=5156620
   Comprehensive C++Builder link site:
http://www.buddydog.org/C++Builder/c++builder.html

 
 
 

1. BCB and SDL ( Simple DirectMedia Layer )...

Hi All,
   Has anyone had any success in using BCB with SDL ( Simple DirectMedia
Layer http://www.libsdl.org ). As Borland are planning to release BCB
for Linux I thought I would look into cross-platform game APIs. But I
could not find any information about using BCB with it.

Thanks,

Dominique.

2. Video cards recommendations?

3. Compile Quake 2 Source Code with BCB...

4. Linear Frame Buffer

5. BCB 1.0 to BCB 3.0 problem...

6. 3D pruning routine

7. TImage in BCB 5 and BCB 6

8. ANN : C++ Demos for SDL and SDL 1.2.4 shipping with Kylix 3...

9. ANN : JEDI-SDL ( formerly known as SDL 4 Delphi ) now has a mailing list set up...

10. Cannot get Direct X 6 examples to compile under BCB 3.0 Help?

11. REPOST : Trying to Compile Quake 2 Source Code with BCB...

12. How do I aline objects with each other with Pov's SDL