Hello, greetings. This is to fix the link error that happens on Windows where lgamma_r() does not exist. The equivalent in MSVC is actually called lgamma() with the sign output parameter (whereas in GNU, lgamma doesn't have a sign output parameter)
I added conditonal compile configs in m.rs to link lgamma on windows and lgamma_r on unix. Also, for windows, I created a lgamma_r function which simply delegates to lgamma. This is so that the rest of the code can assume the existence of lgamma_r.
However, the cons is, it will cause a warning "unnecessary unsafe" in gamma.rs. This is because I need to add an unsafe block in the "faked" lgamma_r for calling lgamma.
To fix that, I simply created a conditional compile in gamma.rs for ln_gamma() to call lgamma_r on unix and lgamma on windows. Assuming ln_gamma() is now the wrapper, there is no point to fake lgamma_r() in m.rs, hence removed in the second commit.
The tests all passed on both Mac OSX and Windows 10.
Please kindly review and let me know if you have any questions/comments.
Hello, greetings. This is to fix the link error that happens on Windows where lgamma_r() does not exist. The equivalent in MSVC is actually called lgamma() with the sign output parameter (whereas in GNU, lgamma doesn't have a sign output parameter)
I added conditonal compile configs in m.rs to link lgamma on windows and lgamma_r on unix. Also, for windows, I created a lgamma_r function which simply delegates to lgamma. This is so that the rest of the code can assume the existence of lgamma_r.
However, the cons is, it will cause a warning "unnecessary unsafe" in gamma.rs. This is because I need to add an unsafe block in the "faked" lgamma_r for calling lgamma.
To fix that, I simply created a conditional compile in gamma.rs for ln_gamma() to call lgamma_r on unix and lgamma on windows. Assuming ln_gamma() is now the wrapper, there is no point to fake lgamma_r() in m.rs, hence removed in the second commit.
The tests all passed on both Mac OSX and Windows 10.
Please kindly review and let me know if you have any questions/comments.
Cheers, Albert