BrianGladman / mpir

Multiple Precision Integers and Rationals
GNU General Public License v3.0
75 stars 36 forks source link

64 bit proxy DLL for fat MSVC builds of MPIR #19

Open wjblanke opened 4 years ago

wjblanke commented 4 years ago

This solution generates a stub proxy DLL for the MPIR library. When applications link to MPIR, they will call this stub proxy DLL instead. The stub proxy DLL analyzes the CPU model it is running on, and then uses LoadLibrary to load the appropriate optimized version of MPIR.dll. It patches all of the MPIR function entrypoints and JMPs to the appropriate function in the optimized version of MPIR.

The basis for the 64 bit stub DLL was automatically generated from the 64 bit GC version of MPIR.dll using the tool below:

https://www.codeproject.com/Articles/1179147/ProxiFy-Automatic-Proxy-DLL-Generation

SanderBouwhuis commented 4 years ago

Oh wow! That's a pretty good idea! Does it work? It states that 'All checks have failed'. Or is that pertaining something else?

wjblanke commented 4 years ago

It's a completely separate solution/project so I don't think it is included in the current MPIR build checks.

Yes it works :-). Enjoy!

BrianGladman commented 4 years ago

Thank you for offering this contribution, which I believe that many users of MPIR on WIndows will appreciate. But it is not clear to me whether it makes sense to integrate it into the MPIR Windows build or whether it is preferable to maintain it as a self standing addition. In particular, if it is to be integrated, it will be necessary to identify a designated and active maintainer of this component of the build as I am not in a position to take on this additional workload.

GitMensch commented 1 year ago

rechecked:

BrianGladman commented 1 year ago

rechecked:

  • this would be indeed very useful for many windows users
  • it should be integrated in this repo, because it depends on all we have here
  • it can (and should) be integrated into the CI and testing, once it is integrated [I volunteer for handling the CI; the old setup is broken, but if my work of today is merged will be fine and extended again]
  • code-wise I'd suggest to have the code staying in "msvc" directly and then add the solution to all vc directories (at least vs2019+vs2022, but I guess this code would also work with vs2013, no?)

Hi Simon, It would be a useful addition to this repository but I would need a volunteer to integrate it into the repository and then maintain it .

Quite a bit of work would be involved as my current build assumes and builds only one specified version of MPIR whereas the proposed addition would need to build each of a number of versions and then package them with the stub library to produce the multi-architecture binary. This is a significant development exercise even though the basic approach has been shown to work.

I don't believe the original proposer was willing to take on this task so the proposal was not pursued further.