Sign in to follow this  

Linux so files.

This topic is 4814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My project I am working has the game in a dll and the engine in the the exe. However I want to make it work on linux and I heard .so files are the equivalent of dlls on linux. I cannot find anything on google about using .so files (probally because I suck at google). Can anyone point me to tutorials on so files?

Share this post


Link to post
Share on other sites
From my MUD source:

DWORD OpenDll(const string& strFilename)
{
DWORD dwRet;

#ifdef BUILD_WINDOWS
dwRet = (DWORD)LoadLibrary(strFilename.c_str());
#endif
#ifdef BUILD_LINUX
dwRet = (DWORD)dlopen(strFilename.c_str(),RTLD_NOW);
#endif
return dwRet;
}

void CloseDll(DWORD hDll)
{
#ifdef BUILD_WINDOWS
FreeLibrary((HMODULE)hDll);
#endif
#ifdef BUILD_LINUX
dlclose((void*)hDll);
#endif
}

void* GetFunction(DWORD hDll, const char* szSymbol)
{
#ifdef BUILD_WINDOWS
return (void*)GetProcAddress((HMODULE)hDll,szSymbol);
#endif
#ifdef BUILD_LINUX
return dlsym((void*)hDll,szSymbol);
#endif
}

Share this post


Link to post
Share on other sites

This topic is 4814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this