Skip to content

Investigate raw-dylib support/workarounds for unicows #15

Closed

Description

@seritools

raw-dylib causes rust to generate import libraries which are, for dependencies, added to their rlib archives. This means they are always linked before unicows.lib, preventing unicows from replacing calls to W Unicode APIs to A APIs on 9x/ME.

I'm not sure there is a sensible way of using both at the moment 🤔

Activity

  1. cher-nov commented on Jul 26, 2026

    @cher-nov

    Just to note. Since #65 unicows is forcibly injected before all the rest on GNU targets to satisfy the order-dependent linker here.
    Maybe make this behavior default and do the same on MSVC ones? That would also eliminate the need to specify standard imports manually.

  2. seritools commented on Jul 26, 2026

    @seritools
    MemberAuthor

    @cher-nov I'd rather not depend on unicows as a requirement in the first place -- that's currently needed because of the weird linker args needed for -gnu

  3. self-assigned this
    on Aug 2, 2026
  4. seritools commented on Aug 2, 2026

    @seritools
    MemberAuthor

    In af0e5f9 I just added a hopefully definitive solution to this:

    It'll link against unicows.lib by default now, in hopefully all required places. To not make it mandatory for NT-only projects, I also added -Zunicows=no as a compiler option to disable that. This should give us the best of both words.

    @Jookia would you mind checking if this also works with the -gnu targets? I think the -lunicows can now be omitted!

    The rust9x-sample config and the docs will then lose that huge block of configuration, and instead gain

    rustflags = [
      # rust9x links against `unicows.lib` by default, make sure it's in your search path.
      '-Clink-arg=/home/seri/mnt/ext4/msvc-toolchains/platformsdk3790/Lib/unicows.lib',
      # If you don't want to use `unicows.lib` (you're not targeting Windows 9x/Me), you can disable it:
      # '-Zunicows=no',
    ]
  5. Jookia commented on Aug 3, 2026

    @Jookia

    I opened a PR to support this on the GNU toolchain. It works properly and the -Zunicows argument works too.

  6. seritools commented on Aug 3, 2026

    @seritools
    MemberAuthor

    Thanks! Merged, squashed things to clean up a bit, updated docs and sample, and rust9x-1.98-beta-v3 includes this now!

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions