question

Mark S3 avatar image
0 Likes"
Mark S3 asked Phil BoBo edited

some flexsim function is not available in Dll-Maker

when I bulit the Dll file by using Dll Maker,I met a problem.

In Visual studio,the "setanimationvar()"function could not be used.But "startanimation()" and other flexsim function could be used accurately.

In Visual studio,I searched the entire solution, I could not find the declaration and definition of the "setanimationvar()" function.

I need to use "setanimationvar()" function .How can I solve this problem?

Thank you in advance

FlexSim 17.1.6
dll maker
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Phil BoBo avatar image
2 Likes"
Phil BoBo answered Phil BoBo edited

Try adding its declaration to your declaration.h and FlexsimFuncs.h:

declaration.h:

inline void setanimationvar(TreeNode* theObj, int animNr, char* varName, const Variant& toVal)
	{return setanimationvaralias1(theObj, animNr, varName, toVal);}
inline void setanimationvar(TreeNode* theObj, char* animName, char* varName, const Variant& toVal)
	{return setanimationvaralias2(theObj, animName, varName, toVal);} 

FlexsimFuncs.h:

	typedef void         (*_setanimationvaralias1)(treenode theObj, int animNr, char* varName, const Variant& toVal);
	typedef void         (*_setanimationvaralias2)(treenode theObj, char* animName, char* varName, const Variant& toVal);
DECLARE_FLEXSIM_FUNCTION_3(setanimationvaralias1, "?setanimationvar@FlexSim@@YAXPAVTreeNode@1@HPADABVVariant@1@@Z", "?setanimationvar@FlexSim@@YAXPEAVTreeNode@1@HPEADAEBVVariant@1@@Z")
DECLARE_FLEXSIM_FUNCTION_3(setanimationvaralias2, "?setanimationvar@FlexSim@@YAXPAVTreeNode@1@PAD1ABVVariant@1@@Z", "?setanimationvar@FlexSim@@YAXPEAVTreeNode@1@PEAD1AEBVVariant@1@@Z")

setanimationvar3.png (188.2 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Mark S3 avatar image Mark S3 commented ·

@phil.bobo,Thank you for your help!

In your method, I put the function declaration and definition in the specified position.I got the expected result: the "setanimationvar()" function is ready to use.

I also want to know why the declaration and definition of this function needs to be added manually.

Maybe one day, I'll have the same problem: a flexsim function is not available in Visual studio(Dll Maker).

0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ Mark S3 commented ·

All of the declarations of the functions were added manually. The dll maker is an open source bitbucket repository.

See the 2008 explanation of how the dll maker works, particularly the "How it all works" section: Creating DLLs that attach to Flexsim

And its commit log: https://bitbucket.org/flexsim/flexsim-dll-maker/commits/all?page=5

You can get exported function addresses using Visual Studio's DUMPBIN utility.

1 Like 1 ·