Skip to content

Use @ccall gc_safe=true for blocking calls #954

Description

@vchuravy

Activity

  1. giordano commented on Jul 13, 2026

    @giordano
    Member

    I presume you meant gc_safe=true for @ccall?

  2. giordano commented on Jul 13, 2026

    @giordano
    Member

    Ooof, I suspect we can't use the @ccall form because we need to set the stdcall call convention on Windows:

    MPI.jl/src/api/api.jl

    Lines 102 to 108 in 9fc3490

    # Microsoft MPI uses stdcall calling convention
    # this only affects 32-bit Windows
    # unfortunately we need to use ccall to call Get_library_version
    # so check using library name instead
    if use_stdcall
    insert!(expr.args, 3, :stdcall)
    end

  3. changed the title [-]Use `ccall=safe` for blocking calls[/-] [+]Use `@ccall gc_safe=true` for blocking calls[/+] on Jul 13, 2026
  4. simonbyrne commented on Jul 19, 2026

    @simonbyrne
    Member

    stdcall is only different on 32-bit windows. Do we need to support that?

  5. giordano commented on Jul 19, 2026

    @giordano
    Member

    I think we actually do it for 64-bit windows too:

    const use_stdcall = startswith(basename(libmpi), "msmpi")

    In any case I already put a PR up to do this: #955

  6. simonbyrne commented on Jul 19, 2026

    @simonbyrne
    Member

    What I meant is that on 64-bit Windows I think the calling conventions are all unified

  7. giordano commented on Jul 21, 2026

    @giordano
    Member

    I'll open a PR to see if we can skip use_stdcall for 64-bit, but as much as I'd personally be happy with dropping support for 32-bit Windows I don't feel like pulling the plug now, we can perhaps do that in the next breaking release (by that time Julia upstream may drop support for 32-bit Windows entirely, making our decision easier)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions