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

mcfgthread, gthread, pthead and linking #43

Closed
Xeverous opened this issue Jan 9, 2020 · 6 comments
Closed

mcfgthread, gthread, pthead and linking #43

Xeverous opened this issue Jan 9, 2020 · 6 comments

Comments

@Xeverous
Copy link

Xeverous commented Jan 9, 2020

I'm using the prebuild compiler from https://gcc-mcf.lhmouse.com on Windows and I'm not sure what my projects should link with. I have noticed there are mcfgthread-12.dll and libwinpthread-1.dll in compiler's installation directory. Should my programs link to both? Is any of these libraries dependent on another?

I have very little knowledge of threading implementation, only using C++ standard library API. Not sure what is missing when I get undefined reference to pthread_mutex_init which happened when I linked my program to libboost_filesystem.

Can you explain what-is-what/what-X-is-implementing-Y/what-X-depends-on-Y from mcfgthread, gthread, pthead, winpthread? What should I know and care about? I don't want to silently corrupt my executables by wrong compiler/linker options.

@lhmouse
Copy link
Owner

lhmouse commented Jan 10, 2020

Those boost libraries are prebuilt ones maintained by MSYS2 which link against winpthreads.

@Xeverous
Copy link
Author

Would be there any problem if I link my program (which uses mcfgthread) to these boost libraries which use winpthreads?

@lhmouse
Copy link
Owner

lhmouse commented Jan 10, 2020

There wouldn't be as long as boost uses exclusively boost::thread, boost::mutex etc. (not the std ones). I haven't verified it though.

@Xeverous
Copy link
Author

What is the reliation between mcfgthread, gthread, pthead, winpthread?

@lhmouse
Copy link
Owner

lhmouse commented Jan 12, 2020

pthread is a specification that is part of POSIX unrelated to any operating system, which specifies the types and functions to manipulate threads.
winpthreads is an implementation that conforms to the aforementioned specification on Windows.

gthread is a specification by GCC to provide types and functions which 0) are used to implement std::mutex, std::thread etc. in libstdc++ and 1) are also used in various other places in libgcc.
mcfgthread is an implementation that conforms to the aforementioned specification that does not involve winpthreads.

@Xeverous
Copy link
Author

That explains all, thanks.

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

2 participants