Page 1 of 1

DBLPREC

Posted: Sat Jul 01, 2023 3:39 am
by Dr John P Weldon
I need to define DBLPREC. Please let me know where and how to do that. '#define DBLPREC' in one of the '.h' files did not work.

Re: DBLPREC

Posted: Sat Jul 01, 2023 7:22 am
by Administrator
I've already given you instructions on what to do here via email. Did they not work?

Re: DBLPREC

Posted: Sun Jul 02, 2023 2:57 am
by Dr John P Weldon
The instructions provided by you in an email dated from some years ago. I have been unable to relate those instructions to the content of project properties in Visual Studio 2022. I have no desire or intention to waste your time or mine on these matters. Nevertheless, I do need additional advice in this case.

Re: DBLPREC

Posted: Sun Jul 02, 2023 3:13 pm
by Administrator
I emailed you on the 29th of June 2023 (and you replied to it), not several years ago.

As I said in the email, all versions of Vensim are now double precision. Your DLL is built for Vensim single precision (which is why you are getting the "external function version mismatch need version 62051 (got 62050)" error). So you need to rebuild your DLL to be compatible with double precision Vensim.

To make your DLL compatible with double precision Vensim, you need to define DBLPREC in your DLL project and rebuild.

Please try this and see if it fixes the problem.

Re: DBLPREC

Posted: Mon Jul 03, 2023 7:55 am
by Dr John P Weldon
I have now located a 'define' of DBLPREC (and DPMATH). It is located in vensim.h. The define is as follows.

#ifndef _VENSIM_H_
#define _VENSIM_H_
#define DBLPREC
#define DPMATH

Vensim.h appears at the start of each '.c' suprogram, such as the following.

#line 1
#include <assert.h>
#include <float.h>
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "c:\users\public\vensim\COMP\vensim.h"
#include "c:\vensim\hosdefs.h"
#include "c:\vensim\hsglob.h"

If you approve of the above define in vensim.h, and of it use in my subprograms, it follows that DBLPREC is not the cause of the syntax error in my Vensim model: 'missing a closing parenthesis on a lookup table call'.

I hope that you can suggest an alternative way of correcting the above error.

Re: DBLPREC

Posted: Mon Jul 03, 2023 1:05 pm
by Administrator
Have you rebuilt the DLL?

Are you still getting the "external function mismatch" warning?

Re: DBLPREC

Posted: Mon Jul 03, 2023 2:55 pm
by tomfid
Rather than defining these in the code, you probably want to define them in the preprocessor, via /D "DBLPREC". In Visual Studio this is in project properties>C/C++>Preprocessor.

Re: DBLPREC

Posted: Mon Jul 03, 2023 2:59 pm
by tomfid
I think this thread viewtopic.php?t=8116 established that the error is caused by a missing : at the beginning of a macro.

Re: DBLPREC

Posted: Tue Jul 04, 2023 10:47 am
by Dr John P Weldon
Thanks for your advice. The problems appear to have been resolved.