Solved: Exposition of a getter returning SBHashMap
-
Hi everyone,
I had an issue that Stephane and my self managed to solve so I post the fix here because it might be useful for other people that could face the same error.
So, I have an importer where I store an SBHashMap and I wanted to expose the getter returning this SBHashMap. To do so, I added the following line to the descriptor of my importer like it is supposed to be done for functions exposition:
SB_INTERFACE_BEGIN; SB_STATIC_FUNCTION_0(SBHashMap<CustomClass1*, CustomClass2*>*, SECustomImporter, getHashMap); SB_INTERFACE_END;But it was not compiling and it was throwing errors saying that the number of arguments of SB_STATIC_FUNCTION_0 was not sufficient. This error might be due to the SBHashMap macro which was not unfolded in a good way.
To fix this error we tried to typedef the SBHashMap<CustomClass1*, CustomClass2*> before exposing it like this:
typedef SBHashMap<CustomClass1*, CustomClass2*> CustomHashMap; SB_REGISTER_TYPE(CustomHashMap, "CustomHashMap", "c5e7844d-1788-41ac-872d-e3d3e9a3c768")As you can see we also registered this now object in the second line using SB_REGISTER_TYPE. Then we modified the exposition like this:
SB_INTERFACE_BEGIN; SB_STATIC_FUNCTION_0(CustomHashMap*, SECustomImporter, getHashMap); SB_INTERFACE_END;This worked perfectly ! If you have troubles with this fix do not hesitate to reply to this post.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login