Skip to content

Commit

Permalink
Moved loaded library handles inside application_t under unix, fixed r…
Browse files Browse the repository at this point in the history
…eferences to missing symbol 'windowIDX'.

Now its just a matter of filling in those stubs...
  • Loading branch information
danij committed Jun 29, 2007
1 parent 8f5227b commit b63a9c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
4 changes: 3 additions & 1 deletion doomsday/engine/unix/include/dd_uinit.h
Expand Up @@ -48,7 +48,9 @@
DDSW_NOCENTER)

typedef struct {
int placeHolder;
lt_dlhandle hGame; // Instance handle to the game library.
lt_dlhandle hPlugins[MAX_PLUGS]; // Instance handle to all other libs.
GETGAMEAPI GetGameAPI;
} application_t;

extern uint windowIDX; // Main window.
Expand Down
26 changes: 13 additions & 13 deletions doomsday/engine/unix/src/dd_uinit.c
Expand Up @@ -69,13 +69,13 @@ typedef struct {

// PUBLIC DATA DEFINITIONS -------------------------------------------------

GETGAMEAPI GetGameAPI;

lt_dlhandle hGame;
lt_dlhandle hPlugins[MAX_PLUGS];
uint windowIDX; // Main window.

// PRIVATE DATA DEFINITIONS ------------------------------------------------

application_t app;
static ddwindow_t *mainWindow;

// CODE --------------------------------------------------------------------

void InitMainWindow(void)
Expand Down Expand Up @@ -109,14 +109,14 @@ boolean InitGame(void)
sprintf(libName, "lib%s", gameName);
strcat(libName, ".so");
#endif
if(!(hGame = lt_dlopenext(libName)))
if(!(app.hGame = lt_dlopenext(libName)))
{
DD_ErrorBox(true, "InitGame: Loading of %s failed (%s).\n", libName,
lt_dlerror());
return false;
}

if(!(GetGameAPI = (GETGAMEAPI) lt_dlsym(hGame, "GetGameAPI")))
if(!(app.GetGameAPI = (GETGAMEAPI) lt_dlsym(app.hGame, "GetGameAPI")))
{
DD_ErrorBox(true,
"InitGame: Failed to get address of " "GetGameAPI (%s).\n",
Expand All @@ -137,8 +137,8 @@ static lt_dlhandle *NextPluginHandle(void)

for(i = 0; i < MAX_PLUGS; ++i)
{
if(!hPlugins[i])
return &hPlugins[i];
if(!app.hPlugins[i])
return &app.hPlugins[i];
}
return NULL;
}
Expand Down Expand Up @@ -396,11 +396,11 @@ void DD_Shutdown(void)
SDL_Quit();

// Close the dynamic libraries.
lt_dlclose(hGame);
hGame = NULL;
for(i = 0; hPlugins[i]; ++i)
lt_dlclose(hPlugins[i]);
memset(hPlugins, 0, sizeof(hPlugins));
lt_dlclose(app.hGame);
app.hGame = NULL;
for(i = 0; app.hPlugins[i]; ++i)
lt_dlclose(app.hPlugins[i]);
memset(app.hPlugins, 0, sizeof(app.hPlugins));

lt_dlexit();
}

0 comments on commit b63a9c4

Please sign in to comment.