473,224 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

pthread_create symbols in libpthread, libthread and libc

There are pthread_create symbols in libphread.so, libthread.so and libc.so.
The following symbols displayed with the nm command:

[Index] Value Size Type Bind Other Shndx Name

[5003] | 637360| 36|FUNC |WEAK |0 |9 |_pthread_create
[2867] | 637360| 36|FUNC |WEAK |0 |9 |pthread_create

[291] | 14964| 8|FUNC |GLOB |0 |7 |_pthread_create
[283] | 14964| 8|FUNC |WEAK |0 |7 |pthread_create

[658] | 48640| 712|FUNC |GLOB |0 |9 |_pthread_create
[259] | 48640| 712|FUNC |LOCL |0 |9 |_ti_pthread_create
[662] | 48640| 712|FUNC |WEAK |0 |9 |pthread_create

The pthread_create() returns -1 linking only libc.so, and work properly
linking both libc.so and libpthread.so in spite of link's ordering.
I understand it is realized using "#pragma weak", so I tried to make a program
to do the same in the following programs, but I can't.
The foo() returns 0 in main.c when linking libfoo.so before libdummy.so,
that is to say, "cc main.c -lfoo -ldummy", but foo() returns -1 when linking
libdummy.so before libfoo.so, that is to say, "cc main.c -ldummy -lfoo".
Could someone tell me about this mechanism?

in main.c
in libdummy.so
#pragma weak foo
int foo()
return -1;
in libfoo.so
#pragma weak foo = _foo
int _foo()
return 0;
Feb 8 '07 #1
1 1928
1,251 Expert 1GB
Wow, I didn't even know that gcc used pragmas. I've only used the __attribute__ for doing similar things.

Anyway, I don't know off hand so I will have to get back to you or you can google the words: gcc and pragma, or go to the gcc documentation at http://gcc.gnu.org/onlinedocs/ which is what I am going to do to answer this question.

Feb 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Hug | last post by:
Hello everybody I try to use gdb to debug my program but i have this message : --------------------------- GNU gdb 5.3 Copyright 2002 Free Software Foundation, Inc. GDB is free software,...
by: Huskier | last post by:
Hi all: I want to pass a class-member function to pthread_create, and my code is in the following, but I don't know how to pass myobj.thread_function to pthread_create function. #include...
by: int main(void) | last post by:
Hi all, What do you people think as the best libc implementation. I'm a newbie, browsing through the open source codes of various libc implementation. I want to what is the best libc...
by: Gary Wessle | last post by:
Hi I am trying to understand how pthread is used, so I make the scenario below, I could not understand the erros by reading the man pthread_create. //**************** code start...
by: erwann | last post by:
On a Linux platform: Hi, I am just trying to pass an integer as an argument to my start_routine when creating a thread with pthread_create: In my .h file: short portfd; void...
by: fantasticamir | last post by:
Guys, I want to call a pointer2function method in pthread_create... I do not know how to do that. here is the code... ..... void * EventInterface::receiveEvent(int x, void...
by: dshereck | last post by:
Hello, I implemented a simple c++ thread wrapper; it works in Linux, but fails in BSD. Here is the code. The idea is that an other class will inherit and implement the virtual methods Setup...
by: unclefester | last post by:
Could someone please explain to me the return type of pthread_create()'s 3rd parameter? I know it should be a function but I keep getting the error: argument of type 'void' (Test::)(void*)' does not...
by: Anna Smidt | last post by:
Hello again, I am trying to convert a VC6 project to VC9, and the linker tells me that it cannot open file 'LIBC.lib'. But I didn't find this lib referenced or added anywhere. I used the linker...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.