Mainline vs Embedded

Do you know where:

extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32
_arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);

Are actually defined?

Many people are getting them via the extern, but then when I go to link,
they’re not found. I’ve tried looking for a CPS.h or what lib/framework that
might be in without much luck. Any help would be greatly appreciated.

CaseyOn 2/23/06, Ulrich von Zadow wrote:

skaller wrote:

Let me re-phrase… it’s completely optional, assuming you do all
the necessary platform specific setup yourself (see SDLmain for
details). :slight_smile:

And how would we know what that is? That’s an implementation
detail application programmers should not need to know about.

I would like to know whether SDL can be used as a library
or not.

At the moment it seems like the answer is YES on Linux
and Windows and NO on OSX.

I can confirm that for Linux and OS X.

I would like to see this fixed – IF it is possible of course.

‘Fixed’ would imply that this is a bug, which it isn’t, since it’s clearly

documented. However, moving some of the initialization code from sdl’s
main to
SDL_Init on OS X would certainly improve the usability of SDL on this
plattform.

Anyway, the magic incantations under OS X are:

#import <SDL/SDL.h>
#import “SDLMain.h”

#import <Cocoa/Cocoa.h>

/* Portions of CPS.h */
typedef struct CPSProcessSerNum
{
UInt32 lo;
UInt32 hi;
} CPSProcessSerNum;

extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn,
UInt32
_arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);

void CustomSDLMain()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[ NSApplication sharedApplication ];
[ NSApp setMainMenu:[[NSMenu alloc] init] ];

 {
     CPSProcessSerNum PSN;
     /* Tell the dock about us */
     if (!CPSGetCurrentProcess(&PSN))
         if

(!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
if (!CPSSetFrontProcess(&PSN))
[NSApplication sharedApplication];
}
}

Call CustomSDLMain before your first call to SDL.

Do you know where:

extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32
_arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);

Are actually defined?

I believe they’re in the Carbon framework.

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

Sam, thank you for responding. I’m already linking against Carbon.framework.

I’m totally stumped. I’ve used spotlight to search for CPS.h and anything
that has CPS in it. It finds SDLMain.m because it’s got those extern
statements, but I’m just not sure where it’s finally finding it. SDL apps
work, but I’m trying to use those CPS calls outside of SDL and getting
linker errors. Very odd.

The CPS calls aren’t even in the API docs, or in man pages. Kind of annoying
really.

Thanks for the help, any other thoughts welcome. What frameworks does SDL
link against? I could just link against all of them and work backwards. :slight_smile:

CaseyOn 8/29/06, Sam Lantinga wrote:

Do you know where:

extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn,
UInt32
_arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);

Are actually defined?

I believe they’re in the Carbon framework.

    -Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

Casey,

This is a private api. There is now a documented way of achieving
that see my message here [1].

Daniel

[1] http://www.libsdl.org/pipermail/sdl/2006-April/073988.html