I am trying implement several external functions while using the multicontext dll (vendlstc.dll). Currently the external function is not working and I suspect it is because I haven't linked my external function to the appropriate .lib file. In the script for the external function I see the following instructions
When you create your external function library you need to link with the
.lib file associated with the program that will call your external functions.
For Vensim DSS this is vensim.lib. For the Vensim DLL it is vendll32.lib
and so on. If you do not do this loading the external functions will likely
fail, possibly with a message that the application is not properly installed.
However I am not sure what the .lib file is for the Multicontext DLL. Is it vendll32.lib?
Would greatly appreciate any assistance
Thanks
Phil
Using External Functions with the Multicontext DLL
-
- Super Administrator
- Posts: 4600
- Joined: Wed Mar 05, 2003 3:10 am
Re: Using External Functions with the Multicontext DLL
Recent versions of the external function library do not need linking with vensim.lib any more.
What exactly is the error you are getting when trying to run a model with external functions? And are you applying a vensim.ini file (that loads the external functions) when loading the multi-context DLL?
Tony.
What exactly is the error you are getting when trying to run a model with external functions? And are you applying a vensim.ini file (that loads the external functions) when loading the multi-context DLL?
Tony.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Using External Functions with the Multicontext DLL
The error log is recording the following error:
External function version mismatch need version 5860 (got 51050)
I have created a file called inifile.ini, which I have placed in the same directory as the .vpm model.
The inifile.ini has the following line:
ExternalFunctionLibrary=C:\wwwtr\vensimmodel\comp\Debug\venext6.dll
To load the model, I have the following commands:
string strModelPath = "C:\\wwwtr\\vensimmodel\\mobTraffSingSP.vpm";
string strVensimCommand = string.Concat("SPECIAL>LOADMODEL|", strModelPath);
int nResult = SimModel.VensimCCommand(VEFCC,strVensimCommand);
string strINIFilePath="C:\\wwwtr\\vensimmodel\\inifile.ini";
strVensimCommand = string.Concat(" SPECIAL>READINI|", strINIFilePath);
nResult = SimModel.VensimCCommand(VEFCC,strVensimCommand);
Thanks
Phil
External function version mismatch need version 5860 (got 51050)
I have created a file called inifile.ini, which I have placed in the same directory as the .vpm model.
The inifile.ini has the following line:
ExternalFunctionLibrary=C:\wwwtr\vensimmodel\comp\Debug\venext6.dll
To load the model, I have the following commands:
string strModelPath = "C:\\wwwtr\\vensimmodel\\mobTraffSingSP.vpm";
string strVensimCommand = string.Concat("SPECIAL>LOADMODEL|", strModelPath);
int nResult = SimModel.VensimCCommand(VEFCC,strVensimCommand);
string strINIFilePath="C:\\wwwtr\\vensimmodel\\inifile.ini";
strVensimCommand = string.Concat(" SPECIAL>READINI|", strINIFilePath);
nResult = SimModel.VensimCCommand(VEFCC,strVensimCommand);
Thanks
Phil
Re: Using External Functions with the Multicontext DLL
It sounds like you need to recompile your external functions with the latest headers etc. to match your dll version.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: Using External Functions with the Multicontext DLL
Many thanks,
You're right, the problem was with the version of Vensim.h file I was using.
When I went back to an earlier version (which had the correct External Function version number) it worked
I suspect that the vendlstc.dll file that I am using is from an 5.10d or possibly earlier. Would that cause the problem?
Thanks again
Phil
You're right, the problem was with the version of Vensim.h file I was using.
When I went back to an earlier version (which had the correct External Function version number) it worked
I suspect that the vendlstc.dll file that I am using is from an 5.10d or possibly earlier. Would that cause the problem?
Thanks again
Phil
-
- Super Administrator
- Posts: 4600
- Joined: Wed Mar 05, 2003 3:10 am
Re: Using External Functions with the Multicontext DLL
>> I suspect that the vendlstc.dll file that I am using is from an 5.10d or
>> possibly earlier. Would that cause the problem?
Yes. The version number that the DLL asks for needs to be the same as the one supplied by the external function library (if that makes sense).
Tony.
>> possibly earlier. Would that cause the problem?
Yes. The version number that the DLL asks for needs to be the same as the one supplied by the external function library (if that makes sense).
Tony.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Using External Functions with the Multicontext DLL
OK that makes sense. What is required to get the multicontext dll upgraded?
Thanks
Phil
Thanks
Phil
-
- Super Administrator
- Posts: 4600
- Joined: Wed Mar 05, 2003 3:10 am
Re: Using External Functions with the Multicontext DLL
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559