Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fmi unload segfault #96

Closed
wants to merge 8 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions src/FMI2/ext.jl
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,78 @@ function fmi2Unload(fmu::FMU2, cleanUp::Bool = true)
@warn "Cannot delete unpacked data on disc. Maybe some files are opened in another application."
end
end
unloadBinary(fmu)
fmu.libHandle = nothing
# fmu.cGetVersion = nothing
return nothing
end

function unloadBinary(fmu::FMU2)
fmu.cInstantiate = nothing
fmu.cGetTypesPlatform = nothing
fmu.cGetVersion = nothing
fmu.cFreeInstance = nothing
fmu.cSetDebugLogging = nothing
fmu.cSetupExperiment = nothing
fmu.cEnterInitializationMode = nothing
fmu.cExitInitializationMode = nothing
fmu.cTerminate = nothing
fmu.cReset = nothing
fmu.cGetReal = nothing
fmu.cSetReal = nothing
fmu.cGetInteger = nothing
fmu.cSetInteger = nothing
fmu.cGetBoolean = nothing
fmu.cSetBoolean = nothing

fmu.cGetString = nothing
fmu.cSetString = nothing

if fmi2CanGetSetState(fmu.modelDescription)
fmu.cGetFMUstate = nothing
fmu.cSetFMUstate = nothing
fmu.cFreeFMUstate = nothing
end

if fmi2CanSerializeFMUstate(fmu.modelDescription)
fmu.cSerializedFMUstateSize = nothing
fmu.cSerializeFMUstate = nothing
fmu.cDeSerializeFMUstate = nothing
end

if fmi2ProvidesDirectionalDerivative(fmu.modelDescription)
fmu.cGetDirectionalDerivative = nothing
end

# CS specific function calls
if fmi2IsCoSimulation(fmu.modelDescription)
fmu.cSetRealInputDerivatives = nothing
fmu.cGetRealOutputDerivatives = nothing
fmu.cDoStep = nothing
fmu.cCancelStep = nothing
fmu.cGetStatus = nothing
fmu.cGetRealStatus = nothing
fmu.cGetIntegerStatus = nothing
fmu.cGetBooleanStatus = nothing
fmu.cGetStringStatus = nothing
end

# ME specific function calls
if fmi2IsModelExchange(fmu.modelDescription)
fmu.cEnterContinuousTimeMode = nothing
fmu.cGetContinuousStates = nothing
fmu.cGetDerivatives = nothing
fmu.cSetTime = nothing
fmu.cSetContinuousStates = nothing
fmu.cCompletedIntegratorStep = nothing
fmu.cEnterEventMode = nothing
fmu.cNewDiscreteStates = nothing
fmu.cGetEventIndicators = nothing
fmu.cGetNominalsOfContinuousStates= nothing
end
end


"""
fmi2SampleJacobian(c::FMU2Component,
vUnknown_ref::AbstractArray{fmi2ValueReference},
Expand Down
Loading