Raised This Month: $51 Target: $400
 12% 

undefined symbol from my own plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
sn4k3
Senior Member
Join Date: Nov 2005
Old 01-13-2011 , 06:43   undefined symbol from my own plugin
Reply With Quote #1

All files got included and my class have no dependency on .so or .a, under windows works but under linux it sucks:

Code:
plugin_load addons/plugintemplate_ep2v
 failed to dlopen /home/tiago/srcds_l/orangebox/cstrike/addons/plugintemplate_ep2v.so error=/home/tiago/srcds_l/orangebox/cstrike/addons/plugintemplate_ep2v.so: undefined symbol: _ZN11CSigScanLib4LoadEP9KeyValues
Unable to load plugin "addons/plugintemplate_ep2v"
Unable to load plugin "addons/plugintemplate_ep2v"
sigscan.h

PHP Code:
#ifndef LIB_SIGSCAN_H
#define LIB_SIGSCAN_H
//=================================================================================
// Defines
//=================================================================================
#define LIB_SIGSCAN_VERSION "1.0"
#define LIB_SIGSCAN_CLASS CSigScanLib

#define SIGSCAN_ASSERT_FUNCTION(_address, _return) \
    
if(!pBase) return _return; \
    if(!
addressName) \
        
addressName _address; \
    
void *pAddr GetFunction(addressNameGamePlayer); \
    if (!
pAddr) return _return;

#ifdef WIN32 /* GCC's member function pointers all contain a this pointer adjustor. You'd probably set it to 0 */
    #define SIGSCAN_END(o) \
        
void *addr;    } u;     u.addr o;    
#else 
    #define SIGSCAN_END(o) \
        
struct {void *addrintptr_t adjustor;} s; } uu.s.addr ou.s.adjustor 0;
#endif


#define SIGSCAN_0(p, o, r1, r2) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(void); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)();

#define SIGSCAN_1(p, o, r1, r2, t1, v1) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1);

#define SIGSCAN_2(p, o, r1, r2, t1, v1, t2, v2) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2);

#define SIGSCAN_3(p, o, r1, r2, t1, v1, t2, v2, t3, v3) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3);

#define SIGSCAN_4(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4);

#define SIGSCAN_5(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5);

#define SIGSCAN_6(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5t6); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5v6);

#define SIGSCAN_7(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5t6t7); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5v6v7);

#define SIGSCAN_8(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5t6t7t8); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5v6v7v8);

#define SIGSCAN_9(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8, t9, v9) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5t6t7t8t9); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5v6v7v8v9);

#define SIGSCAN_10(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8, t9, v9, t10, v10) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5t6t7t8t9t10); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5v6v7v8v9v10);

#define SIGSCAN_STATIC_0(o, r1, r2) \
    
typedef r2 (*func)(); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc();

#define SIGSCAN_STATIC_1(o, r1, r2, t1, v1) \
    
typedef r2 (*func)(t1); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1);

#define SIGSCAN_STATIC_2(o, r1, r2, t1, v1, t2, v2) \
    
typedef r2 (*func)(t1t2); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2);

#define SIGSCAN_STATIC_3(o, r1, r2, t1, v1, t2, v2, t3, v3) \
    
typedef r2 (*func)(t1t2t3); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3);

#define SIGSCAN_STATIC_4(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4) \
    
typedef r2 (*func)(t1t2t3t4); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4);

#define SIGSCAN_STATIC_5(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5) \
    
typedef r2 (*func)(t1t2t3t4t5); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5);

#define SIGSCAN_STATIC_6(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6) \
    
typedef r2 (*func)(t1t2t3t4t5t6); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5v6);

#define SIGSCAN_STATIC_7(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7) \
    
typedef r2 (*func)(t1t2t3t4t5t6t7); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5v6v7);

#define SIGSCAN_STATIC_8(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8) \
    
typedef r2 (*func)(t1t2t3t4t5t6t7t8); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5v6v7v8);

#define SIGSCAN_STATIC_9(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8, t9, v9) \
    
typedef r2 (*func)(t1t2t3t4t5t6t7t8t9); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5v6v7v8v9);

#define SIGSCAN_STATIC_10(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8, t9, v9, t10, v10) \
    
typedef r2 (*func)(t1t2t3t4t5t6t7t8t9t10); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5v6v7v8v9v10);

//=================================================================================
// Class
//=================================================================================
class LIB_SIGSCAN_CLASS
{
public:
    
// SigsScan Function
    
struct SigScan_t
    
{
        const 
char *Name;
        const 
char *Signature;    // Windows
        
const char *Symbol;        // Linux
        
void *pFunction;        // Address to function
    
};

    
// Load signature configs from a KeyValues file
    
bool Load(KeyValues *kvSigscan);

    
// Add signature to list, but never write to file
    
bool Add(const char *name, const char *signature, const char *symbolvoid *pFunction);

    
// Add or Replace a signature to list, but never write to file
    
bool AddOrReplace(const char *name, const char *signature, const char *symbolvoid *pFunction);

    
// Replace a signature from list, but never write to file
    
bool Replace(const char *name, const char *signature, const char *symbolvoid *pFunction);

    
// Remove a signature from list, but never write to file
    
bool Remove(const char *name);

    
// Get the index from list of a sigscan stored on the game configs ie. common.txt and cstrike.txt
    
int GetIndex(const char *name, ...);

    
// Get the sigscan function address
    
void *GetFunction(const char *name, ...);

/************************************************************************************
                                    SigScan Functions
*************************************************************************************/

    // Get Advanced Effects
    
ITempEntsSystem *GetTempEnts(const char *addressName /*= "te"*/);

    
// Switch a player to other team (CSS)
    // void SwitchTeam(int team_index);
    
bool CSSPlayer_SwitchTeam(edict_t *pEntityint team_index, const char *addressName /*= "CSSPlayer::SwitchTeam"*/);

    
// Switch a player to other team (CSS)
    // void SwitchTeam(int team_index);
    
bool CSSPlayer_SwitchTeam(CBaseEntity *pBaseint team_index, const char *addressName /*= "CSSPlayer::SwitchTeam"*/);

    
// Respawn a player (CSS)
    // void RoundRespawn(void);
    
bool CSSPlayer_RoundRespawn(edict_t *pEntity, const char *addressName /*= "CSSPlayer::RoundRespawn"*/);

    
// Respawn a player (CSS)
    // void RoundRespawn(void);
    
bool CSSPlayer_RoundRespawn(CBaseEntity *pBase, const char *addressName /*= "CSSPlayer::RoundRespawn"*/);

/************************************************************************************
                                    Static Methods
*************************************************************************************/

#ifdef WIN32
    
static bool GetDllMemInfo(void *pAddrunsigned char **base_addrsize_t *base_len);
    static 
void *FindSignature(unsigned char *pBaseAddresssize_t baseLengthunsigned char *pSignature);
#endif

    // Holds all signatures
    // Use only to loop
    
CUtlVector<SigScan_tvec_sigscan;

    
// Current game player
    
const char *GamePlayer;
    
};



#endif 
sigscan.cpp
PHP Code:
//=================================================================================
// Includes
//=================================================================================
#define NO_INCLUDE_LIBRARIES
#include "includes/default.h"
#include "serverplugin/serverplugin_engine.h"
#include "libs/lib_string.h"
#include "libs/lib_entity.h"
#include "libs/lib_sigscan.h"

//=================================================================================
// Utilities
//=================================================================================
#ifdef WIN32
static unsigned char HexToBin(char hex_char)
{
    
char upper_char toupper(hex_char);
    return ((
upper_char >= '0' && upper_char <= '9') ? upper_char 48:upper_char 55);
}

static 
bool ValidHexChar(char hex_char)
{
    
char upper_char toupper(hex_char);
    return ((
upper_char >= '0' && upper_char <= '9') || (upper_char >= 'A' && upper_char <= 'F'));
}

//=================================================================================
// Functions
//=================================================================================
// Load signature configs from a KeyValues file
bool LIB_SIGSCAN_CLASS::Load(KeyValues *kvSigscan)
{
    if(!
kvSigscan) return false;
    if(
kvSigscan->IsEmpty())
    {
        
//kvSigscan->deleteThis();
        
return true;
    }
    
KeyValues *kvLoop;
#ifdef WIN32
    
unsigned char *base 0;
    
size_t len 0;
    
bool success GetDllMemInfo(VAR_IFACE_GAMESERVERDLL, &base, &len);
    if(!
success) return false;
#else

#endif
    
for(kvLoop kvSigscan->GetFirstSubKey(); kvLoopkvLoop kvLoop->GetNextKey())
    {
        if(
kvLoop->GetInt("enable"1) <= 0) continue; // Not enabled
        
const char *name kvLoop->GetName();
        if(!
name) continue;
        const 
char *signature kvLoop->GetString("signature"NULL);
        const 
char *symbol kvLoop->GetString("symbol"NULL);
        
void *pFunction NULL;
#ifdef WIN32
        
if(!signature)
        {
            
DevMsg("[WARNING] SigScan: %s got no signature, skip this\n"name);
            continue;
        }
        
pFunction FindSignature(baselen, (unsigned char *)signature);
        if(!
pFunction) continue;
        
AddOrReplace(namesignaturesymbolpFunction);
#else
        
if(!symbol)
        {
            
DevMsg("[WARNING] SigScan: %s got no symbol, skip this\n"name);
            continue;
        }
#endif
        
if(!pFunction) continue;
        
DevMsg("SigScan: %s got address @ %p\n"namepFunction);
        
AddOrReplace(namesignaturesymbolpFunction);
        
//kvLoop->deleteThis();
    
}
    
//kvSigscan->deleteThis();
    
return true;
}
/// ...
/// ... 
dont know why is happening, object is compiled ...

Last edited by sn4k3; 01-13-2011 at 06:48.
sn4k3 is offline
Send a message via MSN to sn4k3
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode