On Thu, 22 Feb 2007, Tsutomu Enokida wrote:
I wanted to check using a simple program that it is possible to call thread
hot programs from
nonthreaded programs using dlopen.
The Sub-program needs to be linked with libpthread.so, but don't need to be
compiled with
-D_POSIX_C_SOURCE=. Is my understanding right ?
For all I can say from this example sourcecode, no.
It neither needs to be compiled -D_POSIX_C_SOURCE=... nor needs to be
linked with -lpthread.
It's not multithreaded at all. Definitely not MT-hot.
Hence, too simple to demonstrate what you'd like to.
Anyway, Casper already answered all, as far as I can see.
FrankH.
Sent: Wednesday, February 21, 2007 8:39 PM
Subject: Re: [osol-code] Any problems with providing only shared librarys
linked with libpthread.so
On Wed, 21 Feb 2007, Tsutomu Enokida wrote:
The following programs work well. Is there any conditions?
Non-trivial testcases. Your 'libsub1.so' doesn't _DEPEND_ on being compiled
-D_POSIX_C_SOURCE=..., it makes no use of any threading facilities
whatsoever.
What does the code below prove/disprove ?
FrankH.
cc -xCC -G -D_POSIX_C_SOURCE=199506L sub1.c -o libsub1.so -lpthread
cc dltest.c -ldl
-- dltest.c --------------------------------
main() {
void * hd1;
int (*fptr1)(void);
if(!(hd1=dlopen("libsub1.so",RTLD_NOW)))
printf("dlopen %s\n",dlerror());
if(!(fptr1=(int(*)())dlsym(hd1,"sub1")))
printf("dlsym %s\n",dlerror());
(*fptr1)();
}
-- sub1.c ---------------------------------
sub1() {
return 0;
}
-----------------------------------------
Thank you,
Enokida
Sent: Wednesday, February 21, 2007 4:55 PM
Subject: Re: [osol-code] Any problems with providing only shared librarys
linked with libpthread.so
For releases of Solaris prior to 10, this is not supported. In
particular, dlopenning libraries that are thread-hot from non-mt safe
programs is known not to work well.
I think it's even worse: even if a program is compiled MT-safe, then
it still can't open libraries which start threads because some things
get confused.
Casper
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code