SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 28/11/2014, 05:27 AM   #261
MD5
Huge Clucker
 
MD5's Avatar
 
Join Date: Nov 2014
Location: United Kingdom
Posts: 255
Reputation: 24
Default Re: Gamemode SDK for C/C++ (GDK)

Finally, was waiting for 4.2
__________________
MD5 is offline   Reply With Quote
Old 01/12/2014, 02:07 AM   #262
diclofoss
Little Clucker
 
Join Date: Apr 2013
Posts: 30
Reputation: 14
Default Re: Gamemode SDK for C/C++ (GDK)

Hello! Unfortunatelly I have CentOS server and want to compile your GDK from the box.
What I have done:
updated GCC to 4.7.6 with devtoolset-1.1
updated python to 2.7
installed cmake
First of all try to make project and success with it.
Next step I turned on the following options:
PHP Code:
option(SAMPGDK_STATIC "Build static library instead" ON)
option(SAMPGDK_BUILD_PLUGINS "Build example plugins" ON)
option(SAMPGDK_BUILD_AMALGAMATION "Build amalgamation" ON
And tried to recompile again:

PHP Code:
[  0%] Built target sampgdk_init
[  2%] Generating lib/sampgdk/a_vehicles.c
[  4%] Generating include/sampgdk/a_http.h
[  6%] Generating include/sampgdk/a_objects.h
[  8%] Generating include/sampgdk/a_players.h
10%] Generating include/sampgdk/a_samp.h
12%] Generating include/sampgdk/a_vehicles.h
14%] Generating lib/sampgdk/a_http.api
16%] Generating lib/sampgdk/a_objects.api
18%] Generating lib/sampgdk/a_players.api
20%] Generating lib/sampgdk/a_samp.api
22%] Generating lib/sampgdk/a_vehicles.api
24%] Generating lib/sampgdk/sampgdk.sym
26%] Generating lib/sampgdk/a_http.c
28%] Generating lib/sampgdk/a_objects.c
30%] Generating lib/sampgdk/a_players.c
32%] Generating lib/sampgdk/a_samp.c
Scanning dependencies of target sampgdk
34%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/amx.c.o
36%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/amxhooks.c.o
38%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/array.c.o
40%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/callback.c.o
42%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/fakeamx.c.o
44%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/hook.c.o
46%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/log.c.o
48%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/logprintf.c.o
51%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/native.c.o
53%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/param.c.o
55%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/plugin.c.o
57%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/timer.c.o
59%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/init.c.o
61%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_samp.idl.c.o
63%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/core.c.o
65%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/interop.c.o
67%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/version.c.o
69%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_http.c.o
71%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_objects.c.o
73%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_players.c.o
75%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_samp.c.o
77%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_vehicles.c.o
Linking C 
static library libsampgdk.a
77%] Built target sampgdk
79%] Generating amalgamation
79%] Built target sampgdk_amalgam
81%] Packaging amalgamation files
Archiving file
: /home/batman/sampx/build/lib/sampgdk/sampgdk.c
Archiving file
: /home/batman/sampx/build/lib/sampgdk/sampgdk.h
Archiving file
: /home/batman/sampx/sampgdk/doc/how-to-use-amalgamation.txt
Done
81%] Built target sampgdk_amalgam_package
Scanning dependencies of target helloworld
83%] Building CXX object plugins/helloworld/CMakeFiles/helloworld.dir/helloworld.cpp.o
85%] Building CXX object plugins/helloworld/CMakeFiles/helloworld.dir/home/batman/sampx/samp-plugin-sdk/amxplugin.cpp.o
Linking CXX shared module helloworld
.so
/usr/bin/ldskipping incompatible /opt/centos/devtoolset-1.1/root/usr/lib/gcc/x86_64-redhat-linux/4.7.2/libstdc++_nonshared.a when searching for -lstdc++_nonshared
/usr/bin/ldcannot find -lstdc++_nonshared
collect2
errorld returned 1 exit status
make
[2]: *** [plugins/helloworld/helloworld.soError 1
make
[1]: *** [plugins/helloworld/CMakeFiles/helloworld.dir/allError 2
make
: *** [allError 2 
Could you help me with this issue?
Many thanks for future investigation
diclofoss is offline   Reply With Quote
Old 01/12/2014, 05:08 AM   #263
diclofoss
Little Clucker
 
Join Date: Apr 2013
Posts: 30
Reputation: 14
Default Re: Gamemode SDK for C/C++ (GDK)

Meanwhile I have reached my windows desctop and successfully followed step-by-step of configuring helloworld example.
Thank you

Last edited by diclofoss; 01/12/2014 at 06:47 AM.
diclofoss is offline   Reply With Quote
Old 01/12/2014, 09:40 AM   #264
iggy1
High-roller
 
iggy1's Avatar
 
Join Date: Mar 2009
Location: One past the end.
Posts: 2,423
Reputation: 271
Default Re: Gamemode SDK for C/C++ (GDK)

I have a problem when linking to the static library, getting the following runtime error when i connect.
Code:
[debug] Run time error 20: "Invalid index parameter (bad entry point)"
This happens as soon as a player connects to the server, not when the server is started.

I don't get this error when i link to the dynamic lib. I've double checked all the project settings, i'm linking to the correct lib, and SAMPGDK_STATIC is defined. Also using the amalgamation.

Note: The function main() exists in the blank mode i have loaded. So that's not what is causing it.
iggy1 is offline   Reply With Quote
Old 01/12/2014, 01:07 PM   #265
GWMPT
High-roller
 
Join Date: Nov 2012
Location: Portugal.
Posts: 993
Reputation: 287
Default Re: Gamemode SDK for C/C++ (GDK)

Quote:
Originally Posted by iggy1 View Post
I have a problem when linking to the static library, getting the following runtime error when i connect.
Code:
[debug] Run time error 20: "Invalid index parameter (bad entry point)"
This happens as soon as a player connects to the server, not when the server is started.

I don't get this error when i link to the dynamic lib. I've double checked all the project settings, i'm linking to the correct lib, and SAMPGDK_STATIC is defined. Also using the amalgamation.

Note: The function main() exists in the blank mode i have loaded. So that's not what is causing it.
If you're using amalgamation, you don't need anything else than sampgdk.c, sampgdk.h, and the plugin SDK.
You just need to define before including sampgdk the following macro: SAMPGDK_AMALGAMATION
Then, you're free to use sampgdk without (using) including the sampgdk (shared) library

Here's an example of the plugin, using SAMPGDK Amalgamation
PHP Code:
#define SAMPGDK_AMALGAMATION
#include <sampgdk.h>

PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData) { return sampgdk::Load(ppData); }
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() { return sampgdk::Supports() | SUPPORTS_PROCESS_TICK;}
PLUGIN_EXPORT void PLUGIN_CALL Unload() { sampgdk::Unload(); }
PLUGIN_EXPORT void PLUGIN_CALL ProcessTick() { sampgdk::ProcessTick(); } 
You don't need "main", "dllMain", etc. to make this dll works, since the moment you have the functions above declared & defined, as well the samphp.def included into the project, and configured correctly.
GWMPT is offline   Reply With Quote
Old 01/12/2014, 01:42 PM   #266
iggy1
High-roller
 
iggy1's Avatar
 
Join Date: Mar 2009
Location: One past the end.
Posts: 2,423
Reputation: 271
Default Re: Gamemode SDK for C/C++ (GDK)

I used this
pawn Code:
#include <sampgdk/sampgdk.h>

PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData) { return sampgdk::Load(ppData); }
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() { return sampgdk::Supports() | SUPPORTS_PROCESS_TICK; }
PLUGIN_EXPORT void PLUGIN_CALL Unload() { sampgdk::Unload(); }
PLUGIN_EXPORT void PLUGIN_CALL ProcessTick() { sampgdk::ProcessTick();

As soon as i connect to the server (even though OnPlayerConnect isn't defined)
Code:
[14:24:56] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
Only happened since updating to 4.2 i was wrong earlier this happens when linking to the dynamic libs too, i hadnt updated them to 4.2 at that point just the static libs.

PS, I use visual studio so the 'SAMPGDK_AMALGAMATION' definition is in my preprocessor definitions in project properties.
iggy1 is offline   Reply With Quote
Old 01/12/2014, 01:56 PM   #267
GWMPT
High-roller
 
Join Date: Nov 2012
Location: Portugal.
Posts: 993
Reputation: 287
Default Re: Gamemode SDK for C/C++ (GDK)

Well, I'm out of possible fixes then.
GWMPT is offline   Reply With Quote
Old 01/12/2014, 02:47 PM   #268
iggy1
High-roller
 
iggy1's Avatar
 
Join Date: Mar 2009
Location: One past the end.
Posts: 2,423
Reputation: 271
Default Re: Gamemode SDK for C/C++ (GDK)

Went back to 4.1 and it's fine. Just wondering if there are any additional steps to setup 4.2 compared to 4.1?
iggy1 is offline   Reply With Quote
Old 01/12/2014, 05:17 PM   #269
xeeZ
Huge Clucker
 
Join Date: Feb 2013
Posts: 319
Reputation: 382
Default Re: Gamemode SDK for C/C++ (GDK)

iggy1: You can safely ignore this error or turn crashdetect off if it bothers you. It's not a bug or something, just need to update crasdhetect to support the new callback system in GDK 4.2. I've already committed a fix for this but haven't released it yet (edit: https://github.com/Zeex/samp-plugin-...es/tag/v4.15.1).

BTW callbacks are bugged in 4.2, you don't want to update to it unless you're not using an empty gamemode because there's a bug where if a callback exists in the gamemode it won't work in the plugin. This will be fixed in 4.2.1 (it's already fixed in git in case you want to check).

diclofoss: I think you need to install a 32-bit libstdc++. I'm not sure how would you do this in CentOS but in Debian-based distrois you would install gcc-multilib and g++-multilib.

Last edited by xeeZ; 02/12/2014 at 02:42 PM.
xeeZ is offline   Reply With Quote
Old 01/12/2014, 07:08 PM   #270
iggy1
High-roller
 
iggy1's Avatar
 
Join Date: Mar 2009
Location: One past the end.
Posts: 2,423
Reputation: 271
Default Re: Gamemode SDK for C/C++ (GDK)

Thanks for the reply, the problem i had would have been the callback bug. When i saw the runtime error in the log i thought that is what was causing it. Will update to 4.2.1 now nice1.
iggy1 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gamemode is unknown. When i connect theres no gamemode. Shannon_Brown Server Support 11 09/09/2012 08:49 AM
[GameMode] Brasil Drift Show [BDS] - Primeiro GameMode vitorzero3um PortuguÍs/Portuguese 3 29/02/2012 06:48 PM
[ENG] Ideas for new GameMode [NL] Ideeen voor nieuwe Gamemode Xtreme-Nicole Everything and Nothing 10 10/07/2011 11:20 AM
[ENG] Ideas for new GameMode [NL] Ideeen voor nieuwe GameMode Xtreme-Nicole Help Archive 2 09/07/2011 11:24 AM


All times are GMT. The time now is 11:11 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.