FOnline Development > Questions and Answers
FOclassic FOClient::SScriptFunc
(1/1)
Medvedev(Req):
Hi. Looking for some help with client functions.
I added my new test function in client.cpp:
int FOClient::SScriptFunc::Global_test_a()
{
return 666666;
}
client.h in ScriptFunc block:
static int Global_test_a();
and scriptbind.cpp by FOCLASSIC_CLIENT defined:
RegisterGlobalFunction( engine, "int test()", focFUNCTION( BIND_CLASS Global_test_a ), asCALL_CDECL );
Server is compiling without any errors. But trying to start with new function in client_main, i get "No matching signatures" error.
May be i didn't add my new function somewhere? But all other native functions are working.
Medvedev(Req):
Resolved it.
If it will be useful to someone: the problem was that client functions need to be declared in dummyData.h - otherwise the server's compiler will not know about their existence. The dummyData library must be compiled before the server, and you need to make sure that the final lib file gets into the source folder for the server solution.
So, the procedure is as follows:
1. Writing a new function in client.cpp
2. Declare in client.h
3. Bind in ScriptBind.cpp (required in the block #if defined (BIND_DUMMY) || defined (BIND_CLIENT))
4. Additionally declare in dummyData.h
5. Clean and rebuild all the solutions of the project.
Navigation
[0] Message Index
Go to full version