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

Create .def files so I can have my own import libraries #302

Closed
retep998 opened this issue Jul 14, 2016 · 3 comments
Closed

Create .def files so I can have my own import libraries #302

retep998 opened this issue Jul 14, 2016 · 3 comments

Comments

@retep998
Copy link
Owner

retep998 commented Jul 14, 2016

Since it is actually really easy to create import libraries from .def files which are plain text files that can be easily edited in a text editor, I should get my own set of .def files for all system libraries that are up to date with the latest Windows 10 version. This would allow for the creation of high quality up to date import libraries for MinGW, so I don't rely on the outdated and sometimes buggy import libraries from MinGW.

As a future extension to this, I can also create MSVC import libraries from these .def files, which can be used on non-Windows platforms that would like to target Windows using the -pc-windows-msvc targets using lld with the link flavor. This would allow the highest quality cross compiling to Windows with no MinGW cruft and no proprietary blobs.

The repository would contain only the .def files with a script to create import libraries from them. The import libraries would in turn be distributed through crates on crates.io which winapi would depend on conditionally using target specific dependencies. There would be a separate crate for each target, so that the user only downloads the version that they need.

@retep998
Copy link
Owner Author

Creating a .def file for stdcall symbols on Windows 32bit is actually incredibly difficult. I'd probably have to write my own .dll with stubs for all the functions along with the .def and then use the resulting .lib, unless someone has a better idea.

@retep998
Copy link
Owner Author

With MinGW it is doable apparently with dlltool. stdcall symbols need to be defined as foo@N in the def files and then the import libraries created by doing dlltool -d foo.def -l libfoo.a -k. It shouldn't be too hard to whip up a program to dump the symbols from Microsoft's import libraries and create def files from them.

@retep998
Copy link
Owner Author

retep998 commented Mar 3, 2017

This has now been solved! I wrote a fancy import library generator.
I then generated a bunch of import libraries and checked them into the repo, along with their .def files! 1f932ce and 7eb10e7

@retep998 retep998 closed this as completed Mar 3, 2017
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

No branches or pull requests

1 participant