zooba commented on issue #44855:
URL: https://github.com/apache/arrow/issues/44855#issuecomment-2501344895

   If you can, I would statically link the C++ redistributables but not the C 
ones. CPython includes the C runtime (`vcruntime140.dll`), and there are 
important reasons to share state there, but we don't include any C++ runtime 
(`msvcp140.dll` and some others), which means if you bundle these DLLs, you're 
going to have to share with whichever other packages have installed them.
   
   Matplotlib made their build change here: 
https://github.com/matplotlib/matplotlib/pull/28687/files
   
   It doesn't really get much shorter than their PR, but the short version is 
that you compile with `/MT` to tell the compiler you want everything statically 
linked, and then use `/nodefaultlib:` to exclude the C runtime and add the 
dynamically linked ones explicitly. This results in statically linked C++ 
runtime code.
   
   As far as I'm aware, the C++ runtime is stateless, so if two extensions have 
different C++ runtimes statically linked then it won't matter. (It _might_ 
matter if they're sharing C++ objects, but then there are other reasons they'd 
need to be built with the same compiler version anyway, so you just need to 
coordinate on that kind of thing.) The C runtime uses a couple of global 
variables for state, so if you have multiple copies loaded, they won't be in 
sync and you can get into trouble.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to