[Request] Function Return
Is there a way to add a function return type? Like when defining a Virtual Table you get a list of functions. On code generator for C++ it all comes out to virtual void FunctionN();. This does not compile, because it is looking for a definition.
For building a class it would be needing to define it as virtual void FunctionN() { };, and for a int return type would be virtual int FunctionN() { return -1; }; (-1 just for the sake as placeholder).
The same goes into parameters: users should be able to type in the parameters (even for classes that does not exist in ReClass) so on code generator does not clear all our changes after the C&P to our SDK (think on 100+ classes and they are not always on the same order, so to re-add manually a bunch of virtual methods is kind of damned).
Thanks for the attention.
Just saw that when adding a function node on a new class there is a way to select and type in the signature. Is there a way to do it inside the VTable?
There is currently no signature field for function pointer nodes because I don't know how to generate code for them.
Example FunctionPointerNode:
Name: MyFnPtr
Signature: int Foo(float param)
The correct code output must be:
int(*MyFnPtr)(float param);
Possible solutions:
- Find a way to combine node name and signature. This is hard if you want to do it right because of types like
int (*(*foo)(float))[3](foo is pointer to function (parameter float) returning pointer to array of 3 int). - If the signature is empty build the signature from the node name and void. If not just output the signature. For a FunctionPointerNode the user needs to set
int (*MyFnPtr)(float param)as signature and for a VirtualMethodNodeint MyFn(float param). This is bad because it is not consistent.
Solution 2 is easy to implement but not intuitive.
Case 1 becomes trivial if you allow the return type to be typedef'd. Then it's a simple name+ret type+args. If it's too complex then you are required to add intermediate typedefs.
int (*(*foo)(float))[3]
is same as (mentally this is how i read it, C requires the weird parens i think)
int* (*foo)(float)[3]
becomes
typedef int RetVal[3];
typedef RetVal* (*MyFnPtr)(float param);
int (*example(float param))[3] {
static int b[3];
b[0] = (int)param;
return &b;
}
int main() {
MyFnPtr p = &example;
return 0;
}