public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* static link last build issue & question
@ 2005-04-12 15:28 Dimitar Panayotov
  2005-04-12 16:26 ` Ross Johnson
  0 siblings, 1 reply; 2+ messages in thread
From: Dimitar Panayotov @ 2005-04-12 15:28 UTC (permalink / raw)
  To: pthreads-win32

Hello. I guess you have much more important issues to solve
in PTW32, but may I remind of one small alteration, which
seem to be not spotted in my preceding post?

When linking statically, <dll.c> must not be included in
<pthread.c> since it is possible you to build a DLL which
you want to be statically linked to PTW32, in which case
your DllMain() will conflict with the PTW32's DllMain().
So, in <pthread.c>, instead of:

#include "dll.c"

the code must be:

#ifndef PTW32_STATIC_LIB
#include "dll.c"
#endif

This will avoid link-time error I mentioned above.
(Note that the static link method I use is to include
<pthread.c> in my project or in the Makefile so that it
will be built with the PTW32_STATIC_LIB macro being
defined, and the object file -- included in the final
link.)

And, because of the obscurity of the statement
[pthread_win32_thread_attach_np() is currently a no-op, but
thread_win32_thread_detach_np() is needed to clean up the
implicit pthread handle that is allocated to a Win32 thread
if it calls certain pthreads routines] (found in
README.NONPORTABLE), I have the following questions:

Can we be supplied with a list of those routines, calling of
which will make it compulsory for the WIN32 thread to call
"pthread_win32_thread_detach_np()" when it exits? And, if
not, is it safe always to call
"pthread_win32_thread_detach_np()" even if no PTW32 API is
used in it?

Thank you.

-
Dimitar Panayotov
develop@mail.bg
+359886420488


--------------------------------------
Безплатната поща в mail.bg вече е 1GB!


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: static link last build issue & question
  2005-04-12 15:28 static link last build issue & question Dimitar Panayotov
@ 2005-04-12 16:26 ` Ross Johnson
  0 siblings, 0 replies; 2+ messages in thread
From: Ross Johnson @ 2005-04-12 16:26 UTC (permalink / raw)
  To: Pthreads-Win32 list

On Tue, 2005-04-12 at 18:28 +0300, Dimitar Panayotov wrote:
> Hello. I guess you have much more important issues to solve
> in PTW32, but may I remind of one small alteration, which
> seem to be not spotted in my preceding post?

Hi,

I didn't miss it. I just did it another way. The dll.c module is
included in the build but the entire content of dll.c is skipped when
building the static library. I thought it would be better to excise the
code itself. Is that causing a problem for you?

> When linking statically, <dll.c> must not be included in
> <pthread.c> since it is possible you to build a DLL which
> you want to be statically linked to PTW32, in which case
> your DllMain() will conflict with the PTW32's DllMain().
> So, in <pthread.c>, instead of:
> 
> #include "dll.c"
> 
> the code must be:
> 
> #ifndef PTW32_STATIC_LIB
> #include "dll.c"
> #endif
> 
> This will avoid link-time error I mentioned above.
> (Note that the static link method I use is to include
> <pthread.c> in my project or in the Makefile so that it
> will be built with the PTW32_STATIC_LIB macro being
> defined, and the object file -- included in the final
> link.)
> 
> And, because of the obscurity of the statement
> [pthread_win32_thread_attach_np() is currently a no-op, but
> thread_win32_thread_detach_np() is needed to clean up the
> implicit pthread handle that is allocated to a Win32 thread
> if it calls certain pthreads routines] (found in
> README.NONPORTABLE), I have the following questions:
> 
> Can we be supplied with a list of those routines, calling of
> which will make it compulsory for the WIN32 thread to call
> "pthread_win32_thread_detach_np()" when it exits? And, if
> not, is it safe always to call
> "pthread_win32_thread_detach_np()" even if no PTW32 API is
> used in it?

It should be safe to call phread_win32_thread_detach_np() even if no
POSIX routines have been called. For instance, I imagine, since you're
project is a dll, you could call these attach/detach routines from your
own dllMain switch.

> Thank you.
> 
> -
> Dimitar Panayotov
> develop@mail.bg
> +359886420488
> 
> 
> --------------------------------------
> Безплатната поща в mail.bg вече е 1GB!
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-12 16:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-12 15:28 static link last build issue & question Dimitar Panayotov
2005-04-12 16:26 ` Ross Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).