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

Logging error in function dlsym_opt #116

Closed
MathiasMalandain opened this issue Jul 24, 2024 · 1 comment · Fixed by #117
Closed

Logging error in function dlsym_opt #116

MathiasMalandain opened this issue Jul 24, 2024 · 1 comment · Fixed by #117

Comments

@MathiasMalandain
Copy link

Context

I am working on a tool for automatic generation of FMUs from Python code. Bumping from FMI2 to FMI3, I am using FMI.jl to try to load and simulate the generated FMUs; it really helps me know which FMI3 functions are still lacking from my codebase, so that I can implement them one after the other.

Description

Function fmi3GetBinary is not yet implemented on my side. The check for whether this function exists or not on the FMU's side is not performed with dlsym, but with the tailor-made dlsym_opt function (defined in src/FMI2/ext.jl in my version, moved to src/binary.jl since). This is the source code of this function:

function dlsym_opt(libHandle, symbol)
    addr = dlsym(libHandle, symbol; throw_error=false)
    if addr == nothing
        logWarning(fmu, "This FMU does not support function '$symbol'.")
        addr = Ptr{Cvoid}(C_NULL)
    end
    addr
end

As the program enters the if block, this is indeed the error I get:

ERROR: LoadError: UndefVarError: `fmu` not defined

The code is still exactly the same in the current src/binary.jl file.

Thank you ❤️

@ThummeTo
Copy link
Owner

ThummeTo commented Aug 9, 2024

Thanks! You are right, we will fix that!

@ThummeTo ThummeTo mentioned this issue Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants