I prepared the next code for Linux but it doesn't load on Linux due to the next error:
Quote:
Couldn't get GiveFnptrsToDll from ../dlls/hmap_i386.so
Couldn't get GetEntityAPI from ../dlls/hmap_i386.so
|
Part of my code is:
PHP Code:
#include "extdll.h"
#if WINDOWS
#pragma comment ( linker, "/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1" )
#pragma comment ( linker, "/SECTION:.data,RW" )
#endif
typedef int ( * ENTITY_API_FN ) ( DLL_FUNCTIONS *, int );
#if WINDOWS
HMODULE g_Module;
typedef void ( WINAPI * ENGINE_API_FN ) ( enginefuncs_t *, globalvars_t * );
#else
void * g_pModule = NULL;
typedef void ( * ENGINE_API_FN ) ( enginefuncs_t *, globalvars_t * );
#endif
#if WINDOWS
extern "C" __declspec ( dllexport ) void WINAPI GiveFnptrsToDll( enginefuncs_t * pEngine_Functions, globalvars_t * pGlobal_Variables ) {
#else
void GiveFnptrsToDll( enginefuncs_t * pEngine_Functions, globalvars_t * pGlobal_Variables ) {
#endif
#if WINDOWS
g_Module = LoadLibrary( L"cstrike\\dlls\\mp.dll" );
ENGINE_API_FN Address = ( ENGINE_API_FN ) GetProcAddress( g_Module, "GiveFnptrsToDll" );
#else
g_pModule = dlopen( "cstrike/dlls/cs_i386.so", RTLD_NOW );
ENGINE_API_FN Address = ( ENGINE_API_FN ) dlsym( g_pModule, "GiveFnptrsToDll" );
#endif
Address( pEngine_Functions, pGlobal_Variables );
}
#if WINDOWS
extern "C" __declspec ( dllexport ) int GetEntityAPI( DLL_FUNCTIONS * pDll_Functions, int ) {
ENTITY_API_FN Address = ( ENTITY_API_FN ) GetProcAddress( g_Module, "GetEntityAPI" );
#else
int GetEntityAPI( DLL_FUNCTIONS * pDll_Functions, int ) {
ENTITY_API_FN Address = ( ENTITY_API_FN ) dlsym( g_pModule, "GetEntityAPI" );
#endif
Address( pDll_Functions, INTERFACE_VERSION );
return 1;
}
Notes:
It doesn't work on Linux but for Windows it works properly.
I think I have to evidence GiveFnptrsToDll for Linux as the first function that should be loaded, but I don't know how.
For Windows, jim_yang and Meta Mod source code helped.
Any help could be greatly appreciated.
__________________