Operating System - Linux
1829556 Members
1822 Online
109992 Solutions
New Discussion

Re: create a library linking code in C and C++

 
SOLVED
Go to solution
Pedro Dinis
Advisor

create a library linking code in C and C++

in aCC i have found the options for aCC in the HP docs , but for cc i cannot find anything

comlib.o:comlib.c comlib.h
cc ??? "non tengo puta idea"

libcommon.o: libcommon.cc libcommon.h
aCC -Aa -c +z libcommon.cc
cp *.o ../../../obj/
rm *.o

library:libcommon.o
aCC -b -o libcommon.so ../../../obj/libcommon.o
cp libcommon.so ../../../lib/
rm libcommon.so

thanks
SLB SLB SLB Glorioso
1 REPLY 1
Dennis Handly
Acclaimed Contributor
Solution

Re: create a library linking code in C and C++

>but for cc I cannot find anything

You want to create a shared lib with just C source? You look at the linker documentation. You can either use cc -b or ld -b.

If you are mixing C and aC++, you link with aCC -b.

comlib.o:comlib.c comlib.h
    $(CC) -c +z comlib.c