ezio_auditore
07-22-2017 14:08
Using MinGW to build Metamod plugin (badf load)
1 Attachment(s)
Hi, all!
I understand that this is not the right place to post this, hence, I request admins to move this post to a more appropriate forum.
Peace.
-----------------------------------------------------------------------------------------------------------------
I am trying to learn how Metamod plugins work, so I compiled the
stub_mm plugin with MinGW using the following commands.
Code:
gcc -D_WIN32 -IE:\hlsdk\common -IE:\hlsdk\dlls -IE:\hlsdk\engine -IE:\hlsdk\pm_shared -IE:\metamod -IE:\stub_plugin -O0 -g3 -Wall -c -fmessage-length=0 -oh_export.o ..\h_export.cpp
gcc -D_WIN32 -IE:\hlsdk\common -IE:\hlsdk\dlls -IE:\hlsdk\engine -IE:\hlsdk\pm_shared -IE:\metamod -IE:\stub_plugin -O0 -g3 -Wall -c -fmessage-length=0 -ometa_api.o ..\meta_api.cpp
gcc -D_WIN32 -IE:\hlsdk\common -IE:\hlsdk\dlls -IE:\hlsdk\engine -IE:\hlsdk\pm_shared -IE:\metamod -IE:\stub_plugin -O0 -g3 -Wall -c -fmessage-length=0 -odllapi.o ..\dllapi.cpp
gcc -D_WIN32 -IE:\hlsdk\common -IE:\hlsdk\dlls -IE:\hlsdk\engine -IE:\hlsdk\pm_shared -IE:\metamod -IE:\stub_plugin -O0 -g3 -Wall -c -fmessage-length=0 -osdk_util.o ..\sdk_util.cpp
gcc -D_WIN32 -IE:\hlsdk\common -IE:\hlsdk\dlls -IE:\hlsdk\engine -IE:\hlsdk\pm_shared -IE:\metamod -IE:\stub_plugin -O0 -g3 -Wall -c -fmessage-length=0 -oengine_api.o ..\engine_api.cpp
And
Code:
gcc -shared -oamx4j.dll sdk_util.o meta_api.o h_export.o engine_api.o dllapi.o
To generate the DLL.
The DLL file is being generated (size 1661KB) without any error, but Metamod cannot find the necessary functions...
These are the logs from Metamod:
PHP Code:
] meta retry amx4j
L 07 / 22 / 2017 - 22 : 56 : 36 : [ META ] ( debug : 5 ) dll : no Meta_Init present in plugin '<amx4j.dll>'
L 07 / 22 / 2017 - 22 : 56 : 36 : [ META ] WARNING : dll : Failed query plugin '<amx4j.dll>' ; Couldn 't find GiveFnptrsToDll(): The specified procedure could not be found.
L 07/22/2017 - 22:56:36: [META] WARNING: dll: Skipping plugin ' < amx4j . dll > '; couldn' t query
Retry failed for plugin '<amx4j.dll>'
] meta retry amx4j
L 07 / 22 / 2017 - 23 : 12 : 03 : [ META ] ( debug : 5 ) dll : no Meta_Init present in plugin '<amx4j.dll>'
L 07 / 22 / 2017 - 23 : 12 : 03 : [ META ] WARNING : dll : Failed query plugin '<amx4j.dll>' ; Couldn 't find GiveFnptrsToDll(): The specified procedure could not be found.
L 07/22/2017 - 23:12:03: [META] WARNING: dll: Skipping plugin ' < amx4j . dll > '; couldn' t query
Retry failed for plugin '
Then I used Eclipse's Object Browser to check the
.o files and found out that the functions are there.
http://i.imgur.com/jcUcpXR.png .
Output of
meta info
Spoiler
PHP Code:
] meta info amx4j
name : ( nil )
desc : < amx4j . dll >
status : badfile
action : load
filename : addons / amx4j / dlls / amx4j . dll
file : amx4j . dll
pathname : c :/ program files ( x86 )/ counter - strike 1.6 / cstrike / addons / amx4j / dlls / amx4j . dll
index : 1
source : ini file
loadable : -
unloadable : -
version : ( nil )
date : ( nil )
author : ( nil )
url : ( nil )
logtag : ( nil )
ifvers : ( nil )
last loaded : Thu Jan 01 05 : 30 : 00 1970
No DLLAPI functions .
No DLLAPI - Post functions .
No NEWAPI functions .
No NEWAPI - Post functions .
No Engine functions .
Complete compilation log
Spoiler
PHP Code:
**** Rebuild of configuration MinGW for project stub_plugin ****
**** Internal Builder is used for build ****
gcc - D_WIN32 - IE :\ hlsdk \ common - IE :\ hlsdk \ dlls - IE :\ hlsdk \ engine - IE :\ hlsdk \ pm_shared - IE :\ metamod - IE :\ stub_plugin - O0 - g3 - Wall - c - fmessage - length = 0 - oh_export . o ..\ h_export . cpp
gcc - D_WIN32 - IE :\ hlsdk \ common - IE :\ hlsdk \ dlls - IE :\ hlsdk \ engine - IE :\ hlsdk \ pm_shared - IE :\ metamod - IE :\ stub_plugin - O0 - g3 - Wall - c - fmessage - length = 0 - ometa_api . o ..\ meta_api . cpp
..\ meta_api . cpp : 70 : 1 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
};
^
..\ meta_api . cpp : 70 : 1 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
..\ meta_api . cpp : 70 : 1 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
..\ meta_api . cpp : 70 : 1 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
..\ meta_api . cpp : 70 : 1 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
..\ meta_api . cpp : 70 : 1 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
..\ meta_api . cpp : 70 : 1 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
gcc - D_WIN32 - IE :\ hlsdk \ common - IE :\ hlsdk \ dlls - IE :\ hlsdk \ engine - IE :\ hlsdk \ pm_shared - IE :\ metamod - IE :\ stub_plugin - O0 - g3 - Wall - c - fmessage - length = 0 - odllapi . o ..\ dllapi . cpp
..\ dllapi . cpp : In function 'int GetEntityAPI2(DLL_FUNCTIONS*, int*)' :
..\ dllapi . cpp : 108 : 65 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
UTIL_LogPrintf ( "GetEntityAPI2 called with null pFunctionTable" );
^
..\ dllapi . cpp : 112 : 110 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
UTIL_LogPrintf ( "GetEntityAPI2 version mismatch; requested=%d ours=%d" , * interfaceVersion , INTERFACE_VERSION );
^
gcc - D_WIN32 - IE :\ hlsdk \ common - IE :\ hlsdk \ dlls - IE :\ hlsdk \ engine - IE :\ hlsdk \ pm_shared - IE :\ metamod - IE :\ stub_plugin - O0 - g3 - Wall - c - fmessage - length = 0 - osdk_util . o ..\ sdk_util . cpp
..\ sdk_util . cpp : In function 'void UTIL_LogPrintf(char*, ...)' :
..\ sdk_util . cpp : 49 : 33 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
ALERT ( at_logged , "%s" , string );
^
gcc - D_WIN32 - IE :\ hlsdk \ common - IE :\ hlsdk \ dlls - IE :\ hlsdk \ engine - IE :\ hlsdk \ pm_shared - IE :\ metamod - IE :\ stub_plugin - O0 - g3 - Wall - c - fmessage - length = 0 - oengine_api . o ..\ engine_api . cpp
..\ engine_api . cpp : In function 'int GetEngineFunctions(enginefuncs_t*, int*)' :
..\ engine_api . cpp : 255 : 75 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
UTIL_LogPrintf ( "GetEngineFunctions called with null pengfuncsFromEngine" );
^
..\ engine_api . cpp : 259 : 122 : warning : deprecated conversion from string constant to 'char*' [- Wwrite - strings ]
UTIL_LogPrintf ( "GetEngineFunctions version mismatch; requested=%d ours=%d" , * interfaceVersion , ENGINE_INTERFACE_VERSION );
^
gcc - shared - oamx4j . dll sdk_util . o meta_api . o h_export . o engine_api . o dllapi . o
Build complete for project stub_plugin
Time consumed : 3434 ms .
Let's hope I find reasonable answers and solution to my problem :(