SDL.DLL w/C++ Builder 5

I’ve been trying to get SDL.DLL to compile under Borland C++ Builder 5,
with limited success. Initially, I was getting a series of WINGDIAPI
Syntax errors, but including windows.h in SDL_wingl.c fixed that. Now,
I’ve got a more ambiguous problem.

If I have all warnings on, it eventually errors out with a ‘Too many error
or warning messages’ message. Disabling a number of warnings in
Product|Options|Compiler|Warnings results in fewer warnings, but it still
fails in the same spot (it just seems to filter the reporting of the
errors, not disable the warnings themselves). I’m not finding any way to
disable or increase the ‘Maximum warnings’ thing. Has anyone else managed
to build SDL-1.2.4 on Borland C++ Builder 5?

The warnings that came up were primarily ‘Conversion may lose significant
digits’, ’ is assigned a value that is never used’, and
’Parameter is never used’.–
Michael Vieths
Foeclan at Visi.com

Michael Vieths wrote:

I’ve been trying to get SDL.DLL to compile under Borland C++ Builder 5,
with limited success. Initially, I was getting a series of WINGDIAPI
Syntax errors, but including windows.h in SDL_wingl.c fixed that. Now,
I’ve got a more ambiguous problem.

If I have all warnings on, it eventually errors out with a ‘Too many error
or warning messages’ message. Disabling a number of warnings in
Product|Options|Compiler|Warnings results in fewer warnings, but it still
fails in the same spot (it just seems to filter the reporting of the
errors, not disable the warnings themselves). I’m not finding any way to
disable or increase the ‘Maximum warnings’ thing. Has anyone else managed
to build SDL-1.2.4 on Borland C++ Builder 5?

The warnings that came up were primarily ‘Conversion may lose significant
digits’, ’ is assigned a value that is never used’, and
’Parameter is never used’.

Are you using the BCB5 makefiles that are included with SDL? I have
been able to compile SDL successfully with those makefiles on BCB5 (of
course, I made them!). See BorlandC.html in the SDL distribution for
more (however minimal) information.

--David Snopek

I’m not finding any way to
disable or increase the ‘Maximum warnings’ thing. Has anyone else
managed
to build SDL-1.2.4 on Borland C++ Builder 5?

I have tried it, too. The compilation succeeded after adding a
WIN32-define to the project options, but the dll-File has just about 47KB
instead of 220KB as the precompiled file.
Trying to compile the test-applications with the self-compiled
sdl.libresulted to some linker errors due to unresolved externals (eg.
SDL_init was not found).

After this failure I tried to use the precomiled libs (version 1.2.4).
To get them work, I had to do the following steps:

  1. defining console_main as main if BORLANDC is set.
  2. compiling sdl_main.c
  3. setting the compiler option b (treat enum as int) before including
    sdl.h

These are exactly the same steps I had to do to get sdl-1.2.3 working.

Regards, Christoph B?hme

Are you using the BCB5 makefiles that are included with SDL? I have
been able to compile SDL successfully with those makefiles on BCB5 (of
course, I made them!). See BorlandC.html in the SDL distribution for
more (however minimal) information.

–David Snopek

I have tried it, too. The compilation succeeded after adding a
WIN32-define to the project options, but the dll-File has just about 47KB
instead of 220KB as the precompiled file.
Trying to compile the test-applications with the self-compiled
sdl.libresulted to some linker errors due to unresolved externals (eg.
SDL_init was not found).

Regards, Christoph B?hme

Just to be thorough, I reinstalled C++ Builder 5 Standard to make sure I
had the default settings. I followed the directions in the BorlandC.html
file. It doesn’t generate any messages, warnings, or errors, and just
stops building at some point while it’s building SDL.dll (same behavior as
before). A ‘find’ doesn’t locate an SDL.dll on my system. If I build
SDLmain.lib, it works and generates the file.

I tried defining WIN32, WIN32_LEAN_AND_MEAN, and _WIN32, with no luck.

I’m beginning to wonder why people like using IDEs. :wink: This was
drastically easier under Linux.On Sat, 11 May 2002, David Snopek wrote:


Michael Vieths
Foeclan at Visi.com

Just to make things stranger…

From the command line, using the same compiler and such I’d expect C++
Builder to be using (since they’re in the C++ Builder bin directory), I
can do a ‘make -f SDL.mak’ in the freebcc directory and it generates
SDL.dll and SDL.lib with no problems. It seems to be confined to C++
Builder.–
Michael Vieths
Foeclan at Visi.com

I’m beginning to wonder why people like using IDEs. :wink: This was
drastically easier under Linux.

It’s not a problem about IDEs. Just, as you provide the Makefile, you could also provide the VC++ or BorlandC
projects, saving a great pain in the a** to those who want to make your project under such environments.

Hi!

> If I build SDLmain.lib, it works and generates the file.

Okay, but the SDLmain.lib will not work for win32-console-applications.
E.g., the following code does not link (the project contains sdlmain.lib
and sdl.lib, of course):

#ifdef WIN32 /* BorlandC defines _ WIN32 _ instead of WIN32 /
#define WIN32 /
without WIN32 defined, no code in sdl_main.h included
at all */
#endif

#include <sdl/sdl.h>

#if __cplusplus
extern “C”
#endif
int main(int argc, char* argv[])
{
return 0;
}

If compiling the code the linker produces an “unresolved external _main
…” error. This happens, because the main function is renamed to
SDL_main. SDL’s win32/sdl_main.c-file contains a function named
console_main which should be the real starting point for console
applications. The problem is that BorlandC like VC++ (for which
console_main is refined to main) starts execution for console apps in main
and not in console_main.
To solve this problem I modified the condition for refining console_main
if VC++ is the compiler in that way that it is refined if _ BorlandC _
is set, too.
Perhaps this could be changed in SDL’s next release.

Regards, Christoph.

Christoph B?hme wrote:

Hi!

If I build SDLmain.lib, it works and generates the file.

Okay, but the SDLmain.lib will not work for win32-console-applications.
E.g., the following code does not link (the project contains sdlmain.lib
and sdl.lib, of course):

#ifdef WIN32 /* BorlandC defines _ WIN32 _ instead of WIN32 /
#define WIN32 /
without WIN32 defined, no code in sdl_main.h included
at all */
#endif

#include <sdl/sdl.h>

#if __cplusplus
extern “C”
#endif
int main(int argc, char* argv[])
{
return 0;
}

If compiling the code the linker produces an “unresolved external _main
…” error. This happens, because the main function is renamed to
SDL_main. SDL’s win32/sdl_main.c-file contains a function named
console_main which should be the real starting point for console
applications. The problem is that BorlandC like VC++ (for which
console_main is refined to main) starts execution for console apps in main
and not in console_main.
To solve this problem I modified the condition for refining console_main
if VC++ is the compiler in that way that it is refined if _ BorlandC _
is set, too.
Perhaps this could be changed in SDL’s next release.

Could you send any changes you make to Sam? I nolonger have access to a
Windows machine in the short term and I am unable to test/check any of
this! Last I tried, the Makefiles/projects/code worked for me …

-- David Snopek

/--------------------
| LibKSD: The C++ Cross-Platform Game Framework
| ? Only want to write it once ?
--------------------