- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How compile a shared library ??? Help !!!!
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
Forums
Discussions
Discussions
Discussions
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
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
01-27-2009 03:13 PM
01-27-2009 03:13 PM
How compile a shared library ??? Help !!!!
I have a progrma in C and I want to compile as a shared library.
My program name is shell.c and this is the code
#include
#include
#include
void sh(char *);
void sh( char *cmd )
{
int num;
num = system(cmd);
}
This is the correct way to compile a shell library ?
$ cc -b -c shell.c
$ ld -r -o shell.so shell.o
I'll call this library from an Oracle 10g procedure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2009 06:18 PM
01-27-2009 06:18 PM
Re: How compile a shared library ??? Help !!!!
$ cc -b +z shell.c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2009 11:48 AM
01-28-2009 11:48 AM
Re: How compile a shared library ??? Help !!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2009 03:48 PM
01-28-2009 03:48 PM
Re: How compile a shared library ??? Help !!!!
I hava a HP-UX itanium 12.23 and the datbase is oracle 10g
When I compile the C programm I can create the .so (shared library) and .o files. But when I tried to call it from the procedure in oracle I receive an error. I think maybe i'm not compiling in the correct way.
I receive the next errors
ora-06520: PL/SQL: Error loading external library
ora-06522 '/oracle/SA_scripts/scripts/shell.so' is not a valid load module. Bad magic
number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2009 04:31 PM
01-28-2009 04:31 PM
Re: How compile a shared library ??? Help !!!!
Oracle is 64 bit so your shlib must be compiled the same way.
$ cc -b +DD64 +z shell.c -o shell.so
>is not a valid load module. Bad magic number
Right I get the same thing:
dlopen error: './libdebug.so' is not a valid load module: Bad magic number
$ file a.out libdebug.so
a.out: ELF-32 executable object file - IA64
libdebug.so: ELF-64 shared object file - IA64
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 04:01 PM
02-11-2009 04:01 PM
Re: How compile a shared library ??? Help !!!!
Do you know what else I need to do?
What is the correct way to compile a shared library?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 04:39 PM
02-11-2009 04:39 PM
Re: How compile a shared library ??? Help !!!!
>What is the correct way to compile a shared library?
Unless you have a new error message or a different question, my answers are the same.
What does "file /oracle/SA_scripts/scripts/shell.so" show?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2009 07:45 AM
02-12-2009 07:45 AM
Re: How compile a shared library ??? Help !!!!
Now I fixed the error of magic number , and I compile the library like you did:
$ cc -b +DD64 +z shell.c -o shell.so
My question now is how can I link this file? in order to create a shell.o
thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2009 07:32 PM
02-12-2009 07:32 PM
Re: How compile a shared library ??? Help !!!!
This compiles and links and creates shell.so in one step.
If you need multiple steps:
cc -c +z sources ...
cc -b -o shell.so objects
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2009 07:39 PM
02-12-2009 07:39 PM
Re: How compile a shared library ??? Help !!!!
http://docs.hp.com/en/14487/libs.htm
http://docs.hp.com/en/14640/OnlineHelp/linkhelp.html
You can also use:
cc +help
ld +help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2009 07:38 AM
02-13-2009 07:38 AM
Re: How compile a shared library ??? Help !!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2009 02:54 PM
02-13-2009 02:54 PM
Re: How compile a shared library ??? Help !!!!
http://forums.itrc.hp.com/service/forums/helptips.do?#33