Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Linking libmy.a with sample driver: (4 Items)
   
Linking libmy.a with sample driver  
Hi,

I have  a library file in .a format which contains my own functions.I copied the library file in /usr/lib.

Change the makefile in the sample ethernet driver.I called my library function in sample ethernet driver and compiled.

Compilation successful.but i try to  load the .so it throws symbol not found error.

Can you please tell me how to link my own libmy.a with devnp-sam.so file.

Regards
Senthil
Re: Linking libmy.a with sample driver  
On Wed, Oct 21, 2009 at 01:04:18AM -0400, Senthil K wrote:
> Hi,
> 
> I have  a library file in .a format which contains my own functions.I copied the library file in /usr/lib.
> 
> Change the makefile in the sample ethernet driver.I called my library function in sample ethernet driver and compiled.

> 
> Compilation successful.but i try to  load the .so it throws symbol not found error.
> 
> Can you please tell me how to link my own libmy.a with devnp-sam.so file.

You're going to want a PIC version of that lib.  In
our nomenclature that would be libmyS.a (a.shared
variant).

If you're using our Makefile structure you'd add:
LIBS+=myS

If not using our Makefiles you'll have to figure
out you're specific knob / compile flag, eg:
# qcc ... -L /tmp -l myS

-seanb
Re: Linking libmy.a with sample driver  
Hi Sean,

Actually mylib.a is a third party library. i don't have code to gernerate shared variant.

Then it is possible to link mylib.a and invoke functions defined in mylib.a in driver code.

Regards
K.Senthil
Re: Linking libmy.a with sample driver  
On Wed, Oct 21, 2009 at 09:46:49AM -0400, Senthil K wrote:
> Hi Sean,
> 
> Actually mylib.a is a third party library. i don't have code to gernerate shared variant.
> 
> Then it is possible to link mylib.a and invoke functions defined in mylib.a in driver code.

It's not really recommended.  The last time I tried
it in a similiar situation the runtime linker would
fix relocations on some architectures (x86 and ppc
IIRC) but not others.

Another option would be to statically link your driver into
the stack.  Check out the io-pkt/sys/static_drvr*.mk files
and STATIC_DRIVERS* defines in io-pkt/sys/target/common.mk.
Note it's been a while since I've tried this as well and
this isn't an officially supported setup.  If you run into
issues I'll look at them as time permits.

-seanb