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

Fix linking issues on Windows #122

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

[target.x86_64-pc-windows-msvc]
rustflags = [
"-C", "link-arg=/FORCE:UNRESOLVED",
]

[target.aarch64-pc-windows-msvc]
rustflags = [
"-C", "link-arg=/FORCE:UNRESOLVED",
]
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
neovim: [v0.8.3, v0.9.4, nightly]
include:
- neovim: v0.8.3
Expand Down
16 changes: 15 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ fn foo() -> oxi::Result<i32> {
}
```

macOS users will also need to set a few linker arguments to tell the Rust
macOS and windows users will also need to set a few linker arguments to tell the Rust
linker that the FFI functions `nvim-oxi` links to will only be available at
runtime. A possible way to do this is to create a `.cargo/config` file with the
following content:

#### MacOS
```toml
[target.x86_64-apple-darwin]
rustflags = [
Expand All @@ -95,6 +96,19 @@ rustflags = [
]
```

#### Windows
```toml
[target.x86_64-pc-windows-msvc]
rustflags = [
"-C", "link-arg=/FORCE:UNRESOLVED",
]

[target.aarch64-pc-windows-msvc]
rustflags = [
"-C", "link-arg=/FORCE:UNRESOLVED",
]
```

After building the crate with `cargo build {--release}`, cargo will place the
compiled artifacts in `target/debug` or `target/release` depending on whether
you built a debug or release version of the crate. If the package name
Expand Down
Loading