I am trying to create an python API using the Vensim MC DLL.
I am wrapping the vensim functions using ctypes in python.
The code works fine and I can create as many context (VensimContextAdd) as needed.
The problem occurs when I try to do VensimContextDrop. A second call to the VensimContextDrop abruptly terminates the program.
Here is a simple python code to show the problem
Code: Select all
import ctypes
# load vensim multicontext dll
vensim = ctypes.windll.vendlstc64
# create vensim context and put context number in list
cid_list = [vensim.VensimContextAdd(1) for x in range(5)]
# view context numbers
print(f"list of cid = {cid_list}")
# drop each context in the cid_list
for cid in cid_list:
ret = vensim.VensimContextDrop(cid)
print(f"Dropped context cid={cid}")
print("END")
Code: Select all
PS C:\test> python .\main.py
list of cid = [1, 2, 3, 4, 5]
Dropped context cid=1
The second call terminated the program. If the call VensimContextDrop was all successful it would executed up to print("END").
Hope someone who has idea about the problem can advise me on this?
Versions I'm using:
Vensim MC DLL : Vensim_9_0_1_VensimMCDLLSetup_30352 - (vendlstc64.dll)
Python version: python 3.9
P.S. Anyone with sample python code utilizing the Vensim MC DLL can share them with me? Would really appreciate it.
Thank you very much in advance