View Single Post
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 12-13-2012 , 18:16   Re: Like "Meta Mod" code from Windows to Linux
Reply With Quote #3

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 GiveFnptrsToDllenginefuncs_t pEngine_Functionsglobalvars_t pGlobal_Variables ) {
#else
void GiveFnptrsToDllenginefuncs_t pEngine_Functionsglobalvars_t pGlobal_Variables ) {
#endif

#if WINDOWS
    
g_Module LoadLibraryL"cstrike\\dlls\\mp.dll" );

    
ENGINE_API_FN Address = ( ENGINE_API_FN GetProcAddressg_Module"GiveFnptrsToDll" );
#else
    
g_pModule dlopen"cstrike/dlls/cs_i386.so"RTLD_NOW );

    
ENGINE_API_FN Address = ( ENGINE_API_FN dlsymg_pModule"GiveFnptrsToDll" );
#endif

    
AddresspEngine_FunctionspGlobal_Variables );
}

#if WINDOWS
extern "C" __declspec dllexport int GetEntityAPIDLL_FUNCTIONS pDll_Functionsint ) {
    
ENTITY_API_FN Address = ( ENTITY_API_FN GetProcAddressg_Module"GetEntityAPI" );
#else
int GetEntityAPIDLL_FUNCTIONS pDll_Functionsint ) {
    
ENTITY_API_FN Address = ( ENTITY_API_FN dlsymg_pModule"GetEntityAPI" );
#endif

    
AddresspDll_FunctionsINTERFACE_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.
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks