spuload.c revision d1ef52979a515c51fdbbe00ce6a5912ef7e968c0
1fb669628faa2eb90d370eb249980b3a1807babaneil_a_wilson/* Copyright (c) 2001, Stanford University
1fb669628faa2eb90d370eb249980b3a1807babaneil_a_wilson * All rights reserved
1fb669628faa2eb90d370eb249980b3a1807babaneil_a_wilson * See the file LICENSE.txt for information on redistributing this software.
1fb669628faa2eb90d370eb249980b3a1807babaneil_a_wilson#define DLL_SUFFIX ".bundle"
2f0f7926326cc76419b074fd91a589cb68980ffbdugan#define DLL_PREFIX ""
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara int rc = RTPathAppPrivateArch (szSharedLibPath, sizeof(szSharedLibPath));
1fb669628faa2eb90d370eb249980b3a1807babaneil_a_wilson sprintf ( path, "%s/%s%sspu%s", szSharedLibPath, DLL_PREFIX, name, DLL_SUFFIX );
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara#endif /* DARWIN */
1fb669628faa2eb90d370eb249980b3a1807babaneil_a_wilson sprintf ( path, "%s%sspu%s", DLL_PREFIX, name, DLL_SUFFIX );
1fb669628faa2eb90d370eb249980b3a1807babaneil_a_wilson sprintf ( path, "%s/%s%sspu%s", dir, DLL_PREFIX, name, DLL_SUFFIX );
1fb669628faa2eb90d370eb249980b3a1807babaneil_a_wilson * Load a single SPU from disk and initialize it. Is there any reason
1fb669628faa2eb90d370eb249980b3a1807babaneil_a_wilson * to export this from the SPU loader library? */
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraSPU * crSPULoad( SPU *child, int id, char *name, char *dir, void *server )
1fb669628faa2eb90d370eb249980b3a1807babaneil_a_wilson the_spu = (SPU*)crAlloc( sizeof( *the_spu ) );
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara the_spu->dll = crDLLOpen( path, 0/*resolveGlobal*/ );
1fb669628faa2eb90d370eb249980b3a1807babaneil_a_wilson (SPULoadFunction) crDLLGetNoError( the_spu->dll, SPU_ENTRY_POINT_NAME );
b26e36d8a08a1c775531659c04abc3d4ed504139jvergara crError( "Couldn't load the SPU entry point \"%s\" from SPU \"%s\"!",
b26e36d8a08a1c775531659c04abc3d4ed504139jvergara /* This basicall calls the SPU's SPULoad() function */
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara if (!the_spu->entry_point( &(the_spu->name), &(the_spu->super_name),
da7ab15aee42edf1c4ff33f66ca717f019b4a578lutoff crError( "I found the SPU \"%s\", but loading it failed!", name );
return NULL;
/*crDebug( "initializing dispatch table %p (for SPU %s)", (void*)&(the_spu->dispatch_table), name );*/
return the_spu;
SPU *
if (!the_spu) {
return NULL;
return child_spu;
void *newFunc)
*f = newFunc;
while (the_spu)