AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Using MinGW to build Metamod plugin (badf load) (https://forums.alliedmods.net/showthread.php?t=299666)

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:5dllno Meta_Init present in plugin '<amx4j.dll>'
L 07/22/2017 22:56:36: [METAWARNINGdllFailed 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:5dllno Meta_Init present in plugin '<amx4j.dll>'
L 07/22/2017 23:12:03: [METAWARNINGdllFailed 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


Complete compilation log
Spoiler


Let's hope I find reasonable answers and solution to my problem :(

PRoSToTeM@ 07-22-2017 17:28

Re: Using MinGW to build Metamod plugin (badf load)
 
Quote:

Originally Posted by ezio_auditore (Post 2536974)
And
Code:

gcc -shared -oamx4j.dll sdk_util.o meta_api.o h_export.o engine_api.o dllapi.o
To generate the DLL.

Try to add -Wl,--kill-at here.

ezio_auditore 07-23-2017 02:21

Re: Using MinGW to build Metamod plugin (badf load)
 
Got it to work.

Strange, but the IDE was causing issues here...
Now I made a script that compiles + deploys the DLL to the game. Thanks :D


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

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