How to implement C++ toggled node?

How to implement C++ toggled node?

mischa_spelt
Advisor Advisor
16 Views
2 Replies
Message 1 of 3

How to implement C++ toggled node?

mischa_spelt
Advisor
Advisor

[ FlexSim 18.1.2 ]

Hi,
Are there any pointers on how to create a C++-toggled node that will execute a member function on a module object? I wanted to 'override' an eventfunction which is called through function_s so I created a C++ toggled node with contents

c->asObject(MyClassName)->MyMethodName(); 

but though FlexSim did not complain it did not call any C++ code either. I tried toggling the node as regular FlexScript and putting in a msg() to make sure it does get called. Any tips?

0 Likes
Accepted solutions (1)
17 Views
2 Replies
Replies (2)
Message 2 of 3

philboboADSK
Autodesk
Autodesk
Accepted solution

Try

o(MyClassName,c).MyMethodName();

Also, if you are trying to call a method on a class defined in your module DLL, you should probably toggle the node as DLL and put it in your DLL instead of C++ compiled into flexsimcontent.dll.

12795-eventfunctions.png

Also, from a C++ toggled node, your MyClassName might be ModuleName::MyClassName because the code isn't in your module's namespace.



Phil BoBo
Sr. Manager, Software Development
Message 3 of 3

mischa_spelt
Advisor
Advisor

Thanks Phil, I was hoping to bind directly to my class method, but I guess a global function coupled to a DLL-toggled node is still the way to go.

0 Likes