You can give basic variables like int, float, var, char, ... as function arguments, but not whole structures as they are too large to pass. I'm not sure about the specifics, but I know that in real C, execution will have a considerable impact on speed when passing large amounts of bytes as argument. You are supposed to pass pointers only. And if you need to copy a structure, either create a copy structure function, or use this generic definition:

Code:
#define clone_struct( source, type ) memcpy( sys_alloc( sizeof( type ) ), source, sizeof( type ) )
...
Type* source_struct = sys_alloc( sizeof( Type ) );
Type* cloned_struct = clone_struct( source_struct, Type );


Not extensively tested but it should work...

Pay attention when you use this though. You might actually need a more specific copy_object function. If a struct contains pointers to other structures that you also need to have copied, its best to create your own copy_object function that does this.

Last edited by Joozey; 09/14/11 22:17.

Click and join the 3dgs irc community!
Room: #3dgs