I struggled today to create the repository: 
<https://github.com/mantielero/fmu.nim>

I managed to fix the above mentioned issue but I hit a new one.

First 
[fmi2Instantiate](https://github.com/mantielero/fmu.nim/blob/1c92e9264a5eb54b12dd16bdd0b1539d5f59c8f2/src/lib/functions/others.nim#L223)
 is called in order to create a 
[ModelInstance](https://github.com/mantielero/fmu.nim/blob/1c92e9264a5eb54b12dd16bdd0b1539d5f59c8f2/src/lib/defs/modelinstance.nim#L43).

Later 
[fmu2SetupExperiment](https://github.com/mantielero/fmu.nim/blob/1c92e9264a5eb54b12dd16bdd0b1539d5f59c8f2/src/lib/functions/common.nim#L9)
 is called.

The library compiles succesfully but when I test it I get:
    
    
    ENTERING: fmi2SetupExperiment
    fmi2CallbackFunctions
    SIGSEGV: Illegal storage access. (Attempt to read from nil?)
    ./build.sh: line 8: 640559 Segmentation fault      (core dumped) 
./fmuCheck.linux64 inc.fmu
    
    
    Run

Could it be that the `ModelInstance` object is freed by Nim before 
`fmi2SetupExperiment` is called? If that is happening how can I prevent it?

Reply via email to