This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
HPUX + shared libs
- To: help-gcc at gnu dot org
- Subject: HPUX + shared libs
- From: Jakub Kocyk <Jakub dot Kocyk at comarch dot pl>
- Date: Tue, 28 Dec 1999 11:16:52 +0100
- Newsgroups: gnu.gcc.help
- Organization: ComArch
- Xref: wodc7nx0 gnu.gcc.help:2307
Can I make "Position Independent Code" (PIC) using gcc v 2.8.1 or
egcs 2.95 on HPUX 11.00. I need it to build shared library which uses
functions
from stdlib. I made following:
compiled following code with: gcc -c runosgk.c
#include <stdio.h>
int RunOsGK(p1,p2,p3)
int p1;
int p2;
int p3;
{
printf("Ok!!!!!!!!!\n");
return 0;
}
void RunOsGK2(p1)
int p1;
{
int a,b;
a+b;
}
than i made librunosgk.sl with:
ld -b -o librunosgk.sl runosgk.o -lc
than I compiled following:
int RunOsGK();
int RunOsGK2();
int main()
{
printf("Ty bucu lesny\n");
RunOsGK2(1);
printf("Ty bucu lesny\n");
RunOsGK(1,2,3);
return 0;
}
with:
gcc -o main main.c -lc -L. -lrunosgk
and executed : ./main
root@posejdon:>./main
Ty bucu lesny
Ty bucu lesny
Illegal instruction (core dumped) <- these code is in RunOsGK in
printf
root@posejdon:>
but when i comment printf in RunOsGK:
#include <stdio.h>
int RunOsGK(p1,p2,p3)
int p1;
int p2;
int p3;
{
//printf("Ok!!!!!!!!!\n");
return 0;
}
void RunOsGK2(p1)
int p1;
{
int a,b;
a+b;
}
and make the same everythink is ok:
root@posejdon:>./main
Ty bucu lesny
Ty bucu lesny
root@posejdon:>
What I am doing wrong?
In HP told me that i should use their HP ansi c compailer (but it
costs, i have only one short library to compile).
Is it posible to do this library using gcc?
Than in advance for your help
Kuba