Mac SDL queries

I’ve been trying to use SDL on the MacOS, and have a few questions.

First of all, I can’t seem to make it work with CodeWarrior Pro 4.
The libraries shipped with CodeWarrior don’t seem to correspond
totally with those in the MPW examples. I tried swapping them around
in a number of ways, and sorta got it to compile and link, but it
crashed before it even got to calling my code. I begun to learn MPW,
so the question may be academic at some point, but does anybody know
how to make SDL work with CodeWarrior Pro 4?

My second query concerns the command line prompt which was the only
part which actually worked in that compile. I wonder if there is any
way to make it so that command line prompt does not show up? And if
not, if there is any chance that in future versions said prompt might
be relegated to only when option is held down? That is, after all,
already sort of a standard on the MacOS, presenting extra startup
options when the option key is held down. Quake and Unreal even used
that specifically for command line prompts.
,---------------------------------------------------------.
/ /// /// _/ _/ // Michael Powell /
/ _/ _/ _/ _/ _/ _/ _/ / /
/ //
/ // / /// // Aspiring /
/ _/ _/ _/ _/ _/ / / / Video Game /
/ //
/ //
/ //
/ _/ _/ _/ _/ Programmer /
`---------------------------------------------------------’

First of all, I can’t seem to make it work with CodeWarrior Pro 4.
The libraries shipped with CodeWarrior don’t seem to correspond
totally with those in the MPW examples. I tried swapping them around
in a number of ways, and sorta got it to compile and link, but it
crashed before it even got to calling my code.
Could we get some more details on how you swapped them around? If you
don’t set up CodeWarrior shared libraries just right, then just make empty
libraries.
Try some prebuilt library projects
http://icdweb.cc.purdue.edu/~walisser/gltron/SDL_CWprojects.sea.hqx, I
haven’t personally used them, so I’d be interested to know if they work.

I begun to learn MPW,
so the question may be academic at some point, but does anybody know
how to make SDL work with CodeWarrior Pro 4?
To be honest, for my alpha projects, I just cheat and link the source in
directly.

I wonder if there is any
way to make it so that command line prompt does not show up?
Compiled into the resource fork of every mac SDL program is a template for
the ‘CLne’ resource. It lets you create a default command line, and put if
you even want the command line dialog displayed or not. Just put a CLne
ID:128 into the program file, and everything will be fine.

Kyle

f u cn rd ths thn u cn gt gd jb prgrmmng cmptrs---------
The opinions expressed do not reflect those of my
employer. Mostly because I’m unemployed.
------E4D8 9DE7 C3DC 424A 20F9 79CF 7414 2E99 2E54 6B5C

Could we get some more details on how you swapped them around? If you
don’t set up CodeWarrior shared libraries just right, then just make empty
libraries.

Lets see… The first time, I kept all the libraries which
CodeWarrior includes standard in it’s C projects (MSL RuntimePPC.Lib,
InterfaceLib, MathLib, MSL C.PPC.Lib), minus a couple obviously
irrelivent ones (MSL C++.PPC.Lib and MSL SOUIX.PPC.Lib). Then, I
added what I could find of the libraries mentioned in the MPW make
file (StdCLib and PPCToolsLib). At this point it linked, but crashed
before it got to any of my code. Then I removed ALL these libraries,
downloaded MPW, hunted out all the precise libraries the makefile
included, and put them in CodeWarrior, and it wouldn’t link because
it couldn’t find a symbol called “__files”.

Try some prebuilt library projects
http://icdweb.cc.purdue.edu/~walisser/gltron/SDL_CWprojects.sea.hqx, I
haven’t personally used them, so I’d be interested to know if they work.

Well, thanks, but those are CW Pro 5 projects, and I’m running CW Pro
4. It won’t open them.

To be honest, for my alpha projects, I just cheat and link the source in
directly.

Hmm. That’s a good idea. If all else fails, I’ll give that try.

Compiled into the resource fork of every mac SDL program is a template for
the ‘CLne’ resource. It lets you create a default command line, and put if
you even want the command line dialog displayed or not. Just put a CLne
ID:128 into the program file, and everything will be fine.

Ah, thank you!

  ,---------------------------------------------------------.
 / _/_/_/    _/_/_/  _/        _/    _/_/   Michael Powell  /
/ _/    _/  _/      _/      _/  _/  _/  _/                 /

/ //_/ // / /// // Aspiring /
/ _/ _/ _/ _/ _/ / / / Video Game /
/ //
/ //
/ //
/ _/ _/ _/ _/ Programmer /
`---------------------------------------------------------’

Then I removed ALL these libraries, downloaded MPW, hunted out all
the precise libraries the makefile included, and put them in
CodeWarrior, and it wouldn’t link because it couldn’t find a symbol
called “__files”.

Okay, I’ve investigated this a little more. Looked through the header
files and finally realized how SDL manages to have code executing
before mine ("#define SDL_main main"… Quite clever, and somehow
rather evil :wink: ). Anyway, that’s beside the point. The __files
identifier is called from my SDL_main according to the think error,
though I never used that identifier. I searched for it all the SDL
headers and system headers, and found it in “cstdio”, which I assume
is CodeWarrior’s version of “stdio.h”, in the lines:

#define stdin (&__files[0]) /* mm 961031 */ /*MW-mm 961203 /
#define stdout (&__files[1]) /
mm 961031 */ /*MW-mm 961203 /
#define stderr (&__files[2]) /
mm 961031 */ /*MW-mm 961203 /
/
rjk 980313 add the _MSL_DLLDATA macro /
extern _MSL_DLLDATA FILE __files[]; /
mm 961031 */ /*MW-mm 961203 */

However, I still don’t know what library actually declares this
extern __files variable. Currently, I’m including: InterfaceLib,
StdCLib, MathLib, StdCRuntime.o, PPCCRuntime.o, PPCToolLibs.o,
OpenGLLibraryStub, OpenGLUtilityStub, SDL and SDLmain.o. Everything
besides the GL and SDL libraries were stolen from MPW, which I think
might be part of the problem. The MPW libraries may not totally agree
with the CodeWarrior includes. Could you maybe list out exactly what
CodeWarrior libraries you’re including in your projects, Kyle?

  ,---------------------------------------------------------.
 / _/_/_/    _/_/_/  _/        _/    _/_/   Michael Powell  /
/ _/    _/  _/      _/      _/  _/  _/  _/                 /

/ //_/ // / /// // Aspiring /
/ _/ _/ _/ _/ _/ / / / Video Game /
/ //
/ //
/ //
/ _/ _/ _/ _/ Programmer /
`---------------------------------------------------------’

Are you using MPW with the CodeWarrior 5 headers? Maybe using MPW’s headers
would fix this problem.

Then I removed ALL these libraries, downloaded MPW, hunted out all
the precise libraries the makefile included, and put them in
CodeWarrior, and it wouldn’t link because it couldn’t find a symbol
called “__files”.

The __files
identifier is called from my SDL_main according to the think error,
though I never used that identifier. I searched for it all the SDL
headers and system headers, and found it in “cstdio”, which I assume
is CodeWarrior’s version of “stdio.h”, in the lines:

FYI, cstdio is the C++ name of stdio.h. I think stdio.h #includes cstdio.

#define stdin (&__files[0]) /* mm 961031 */ /*MW-mm 961203 /
#define stdout (&__files[1]) /
mm 961031 */ /*MW-mm 961203 /
#define stderr (&__files[2]) /
mm 961031 */ /*MW-mm 961203 /
/
rjk 980313 add the _MSL_DLLDATA macro /
extern _MSL_DLLDATA FILE __files[]; /
mm 961031 */ /*MW-mm 961203 */

From the looks of this it is MSL.C.PPC.LIB and/or MSL.C.PPC.DLL. Possibly
SIOUX.PPC.LIB. You might be able to hack it with the following global in
your code:

FILE __files[3];

Everything
besides the GL and SDL libraries were stolen from MPW, which I think
might be part of the problem.

My thoughts exactly. As I said before, probally better not to use
CodeWarrior headers in MPW. If you do use CW headers, don’t link with any
MPW libs, use the MPW libs CW provides.

HTH,
Darrell

My thoughts exactly. As I said before, probally better not to use
CodeWarrior headers in MPW. If you do use CW headers, don’t link with any
MPW libs, use the MPW libs CW provides.

Actually, it’s the exact reverse… I’m using MPW libraries in
CodeWarrior. I don’t particularly like MPW, at least not when placed
next to CodeWarrior, and given the choice I’ll take CodeWarrior any
day. However, I don’t have and can’t afford at the moment to get Pro
5, so I’m still using Pro 4, which I think may be part of the trouble
as well. Every case of SDL with CodeWarrior that I’ve seen so far has
been with Pro 5.

  ,---------------------------------------------------------.
 / _/_/_/    _/_/_/  _/        _/    _/_/   Michael Powell  /
/ _/    _/  _/      _/      _/  _/  _/  _/                 /

/ //_/ // / /// // Aspiring /
/ _/ _/ _/ _/ _/ / / / Video Game /
/ //
/ //
/ //
/ _/ _/ _/ _/ Programmer /
`---------------------------------------------------------’