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

Linker issues with "cargo build" in Windows? #31

Closed
mattia-donato opened this issue May 16, 2023 · 4 comments · Fixed by #33
Closed

Linker issues with "cargo build" in Windows? #31

mattia-donato opened this issue May 16, 2023 · 4 comments · Fixed by #33

Comments

@mattia-donato
Copy link

Hello,

I am trying to compile with the command cargo build your version of "ni-fpga-rs" and I get a linker error.

  = note: LINK : fatal error LNK1181: cannot open input file 'NiFpga.lib'
error: could not compile `integration` (bin "integration") due to previous error

Where I can get it? I can find only NiFpga.DLL in LabView folder.

@connorworley
Copy link
Collaborator

Hello,
This project has primarily been developed to target Linux where a static version of NiFpga is available. Your best bet is probably trying to find a static version for Windows. If that's not possible, loading a DLL at runtime would require some changes -- mainly replacing FFI calls in session.rs with dynamic equivalants -- but nothing too different. Unfortunately I don't have a Windows machine with LabVIEW to test against, but a PR to conditionally use the dynamic approach on Windows would be welcome.

@mattia-donato
Copy link
Author

mattia-donato commented May 16, 2023

Thank you for your answer.
In the meanwhile, I could compile. I still have to test but googleing i found out that it is possible to convert a ".dll" to a ".lib" by the following by running on the cmd.exe inside Visual Studio environment the following:

echo LIBRARY NIFPGA > nifpga.def
echo EXPORTS >> nifpga.def
for /f "skip=19 tokens=4" %A in ('dumpbin /exports nifpga.dll') do echo %A >> nifpga.def

and then

lib /def:nifpga.def /out:nifpga.lib /machine:x64

@ThadHouse
Copy link
Contributor

This is fixed with #33. It now dynamically links to nifpga, which is installed on system32 on windows. @auscompgeek this should be closable now.

@auscompgeek auscompgeek linked a pull request Sep 8, 2023 that will close this issue
@auscompgeek
Copy link
Member

I'll bump the versions later today.

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.

4 participants