External function version mismatch

Use this forum to post Vensim related questions.
Post Reply
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

External function version mismatch

Post by Dr John P Weldon »

I have upgraded to Vensim DSS version 8.0.9 x32. This generates an error message: 'external function version mismatch need 62051 get 51050'. Please advise how to make this go away.
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: External function version mismatch

Post by tomfid »

This means you have an external function library loaded that needs to be recompiled with the new version's headers.

If you're not using it, you can delete the reference at Tools>Options>Startup.
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

Re: External function version mismatch

Post by Dr John P Weldon »

Thank you for responding. I deleted the DLL address in tools>options>startup, then exited Vensim. I recompiled the DLL. When I re-entered Vensim the 'mismatch' message had disappeared. It had previously occurred when I double-clicked on the Vensim icon in the desktop: ie before I tried to load a model.

I then re-entered Vensim and retyped/saved the DLL address in tools>options>startup. After exiting and again re-entering Vensim the 'mismatch' message reappeared, although I had recompiled the DLL.

This apparently means that, if a DLL address appears in tools>options>startup at the time of login to Vensim, the 'mismatch' message is shown. I have never encountered that previously. It looks like a bug in the latest version of DSS. What do you think?
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: External function version mismatch

Post by Administrator »

Did you update your code so that it uses the new header files that ship with the latest version of Vensim?
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
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: External function version mismatch

Post by tomfid »

Right - you need to modify your .dll project to use the new copy of vensim.h etc. (typically in users\public\comp).
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

Re: External function version mismatch

Post by Dr John P Weldon »

Vensim.h is apparently the only Vensim-type header file in my subprograms. I made the latest version of vensim.h available to those subprograms. When I recompiled the DLL I got error C2039 in venext.c: 'tot_vol' is not a member of 'tag_dim_info_vdf'.

'tot_vol' is in static void validate_vector_arg(VECTOR_ARG *v, int firstind, int lastind).

Perhaps Vensim updates need to handle these issues automatically, during 'install'. Eg changing all versions of vensim.h on the user's hard disk to the latest. Otherwise, the solution of one problem leads to emergence of the next problem, and so on.

What do you suggest as a next step?
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: External function version mismatch

Post by Administrator »

I'd suggest using the example external function library that ships with Vensim and copying your own functions into it. tag_dim_info_vdf indicates that you are not compiling with the define _VDFX, the best option would be to start with the sample DLL we provide and update it.
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
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: External function version mismatch

Post by tomfid »

Can the existing setup be preserved via addition of _VDFX to the compiler preprocessor definition list, or are there other things that need to change?

One option would be to do a diff on the new shipping venext.c example vs. your venext.c and see what differs.
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

Re: External function version mismatch

Post by Dr John P Weldon »

_VDFX is mentioned in the Vensim context only in platform_specific.h. In this file _VDFX is
defined only #ifdef _WIN64. I am not using WIN64, as far as I know.

Each of my applications has a dedicated venext.c. Beyond those I am unsure which is the file that is
shipped with Vensim. I have selected a likely file for comparison.

In the template is 'GLOB_VARS *VENGV='\0';' The equivalent in my DLL is GLOB_VARS *VENGV;

Also in the template subprograms are made 'double'. In my DLL they are 'extern REAL'.

I am unsure about making changes, because those may get me into further trouble, from which I could not extricate myself.

As previously stated, I also consider that such issues should be handled by Vensim downloads/upgrades.

Where to from here?
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: External function version mismatch

Post by Administrator »

We had to update the DLL interface with the latest version of Vensim as we moved to 64 bit. It doesn't matter if you are still running a 32 bit operating system, the interface between Vensim and the DLL is still the same.

You could try defining VDF and _VDFX in your project and see if it works.
As previously stated, I also consider that such issues should be handled by Vensim downloads/upgrades.
Obviously there is no way we can write something to detect and update your source code. The best we can do is provide a sample project which builds and runs in both 32 and 64 bit versions of Vensim (which we have done). All you should need to do is use this as a template and copy/paste your own modifications in.
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
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

Re: External function version mismatch

Post by Dr John P Weldon »

I defined VDF and _VDFX in venext.c and recompiled the DLL. Those definitions made a negative
difference to the outcome: 'the external functions in [the DLL] could not be loaded'. I was
shut out, until I stated that the DLL should not be loaded next time. Should I remove the
above definitions, or do them elsewhere in the DLL?

The DLL and its models worked on earlier versions of DSS; up to a version earlier than 7.2.
The current outcome ('tot_vol' is not a member of 'tag_dim_info_vdf') only appeared when I
introduced the latest version of vensim.h. Does that provide a clue?

Please send the template project to abbeylane21@outlook.com.

Would you be interested in looking at the problem on my PC through Teamviewer?
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: External function version mismatch

Post by Administrator »

Dr John P Weldon wrote: Sun Apr 05, 2020 1:33 pm I defined VDF and _VDFX in venext.c and recompiled the DLL. Those definitions made a negative
difference to the outcome: 'the external functions in [the DLL] could not be loaded'.Should I remove the
above definitions, or do them elsewhere in the DLL?
This error suggests the DLL has not compiled properly.

You need these definitions. The best place to define them is in the Visual Studio project, pre-processor definitions.
Dr John P Weldon wrote: Sun Apr 05, 2020 1:33 pm The DLL and its models worked on earlier versions of DSS; up to a version earlier than 7.2.
The current outcome ('tot_vol' is not a member of 'tag_dim_info_vdf') only appeared when I
introduced the latest version of vensim.h. Does that provide a clue?
Yes, you need to define VDFX and _VDFX and use the latest vensim.h as we've already said.
Dr John P Weldon wrote: Sun Apr 05, 2020 1:33 pm Please send the template project to abbeylane21@outlook.com.
You already have it on your machine, check C:\Users\Public\Vensim\COMP\VensimExternalFunctionLibrary\Windows
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
Dr John P Weldon
Member
Posts: 39
Joined: Sun Oct 07, 2018 7:56 pm
Vensim version: DSS

Re: External function version mismatch

Post by Dr John P Weldon »

I included _VDFX in preprocessor definitions. No improvement resulted.

I have looked at the template venext.c in c:\users\... Many choices and decisions will need to be made, in aligning my existing venext.c with the new one. I would not feel confident in making those choices and decisions.

Can you suggest a suitable person for the task? I would, of course, be willing to pay.
Post Reply