- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: linker problem?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2004 06:06 PM
тАО09-01-2004 06:06 PM
linker problem?
#include
void hello()
{
rintf("Hello World");
}
Here instead of printf I have purposfully put an error namely "rintf"
Now I compiled this code using the comand
/opt/ansic/bin/cc -c +Z -o temp.o temp.c
After compilation I created a library libhello.sl containing the object file created above using the command
/opt/ansic/bin/cc -b temp.o -o libhello.sl
Now the linker is supposed to complain saying "unresolved symbol" for "rintf" but it does not do so. When i use this sl with a sample program still it does not complain about the symbol rintf while compilation. But when I run the sample application, it gives:
/usr/lib/dld.sl: Unresolved symbol rintf (code) from ./libhello.sl
ABORT instruction (core dumped)
Thankyou
Moiz Khambaty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2004 07:18 PM
тАО09-01-2004 07:18 PM
Re: linker problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2004 07:26 PM
тАО09-01-2004 07:26 PM
Re: linker problem?
After doing compilation as cc -c <..> we must have to do link to execute the particular object file. So It is not in the linked format.
During the shared library creation it is creating the shared library file using the non-linked temp.o file
So during the application usage on the sl only it is getting linked and getting compiled as,
/usr/lib/dld.sl: Unresolved symbol rintf (code) from ./libhello.sl
ABORT instruction (core dumped)
You can try as,
/opt/ansic/bin/cc temp.c -o temp.o
Some warning will be there from compiler ( -c will supress them and execution file a.out)
If you do it successfully without error then use cc -b temp.o -o libhello.sl
You will get more problem's for your try as
#include
void hello()
{
rintf("Hello World");
}
as
1> no main..
2> return type etc
Regards
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2004 07:34 PM
тАО09-01-2004 07:34 PM
Re: linker problem?
"Here instead of printf I have purposfully put an error namely "rintf" "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2004 11:23 PM
тАО09-01-2004 11:23 PM
Re: linker problem?
--
ranga
[i work for hpe]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2004 11:36 PM
тАО09-01-2004 11:36 PM
Re: linker problem?
+vallunsats when linking an executable will list unsats in the shared libraries in the link line.
now by unsats i mean symbols not resolved but required to be resolved, as far as the linker can find out from the direct calls made in the modules being linked.
when building an executable, the linker expects all symbols to be resolved (unless you say +allowunsats). here the requirement for resolving all referenced symbols is driven/ensured by the compiler specifying 'main' as an unsat in the link line (add -v to compile line to see that). so an unresolved symbol is an error in that case.
when building a shared library, the linker actually allows for unsats. so an unresolved symbol will never be an error, it will be a warning at best.
--
ranga
[i work for hpe]