Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Creating a Shared Library in BSP using IDE: (5 Items)
   
Creating a Shared Library in BSP using IDE  
Hello,
I am trying to create a shared library in the BSP. I am using the QNX Momentics IDE (6.4.x).
I want to move some common source files in the BSP code (that I added) into a different folder and create a shared 
library which can be accessed by the different drivers in the BSP. Currently these files are getting duplicated in the 
various drivers.
I would appreciate any help on how this can be achieved.

Thanks,
Arun
Re: Creating a Shared Library in BSP using IDE  
Hi, Arun,

You will need to create a new section/component folder in your BSP 
project that has a folder for the "so" variant (indicating shared 
library) and put your sources into that new section folder.

For example, in an ARM BSP, you might do

   src/
     Makefile  [ LIST=SECTION ]
     lib/
       Makefile  [ LIST=COMPONENT ]
       mylib/
         Makefile  [ LIST=CPU]
         common.mk
         arm/
           Makefile  [LIST=VARIANT]
           so.le/
             Makefile  [ include ../../common.mk ]
         source_1.c
         source_2.c
         ...
         source_n.c

Then, add the library to the appropriate EXTRA_LIBVPATH and LIBS macros 
in the common.mk files of the drivers that will link your library.

Your BSP may have examples of this structure that you can emulate, in 
the src/lib/ tree.

HTH,

Christian


On 30/08/10 04:19 PM, Arun Parameswaran wrote:
> Hello,
> I am trying to create a shared library in the BSP. I am using the QNX Momentics IDE (6.4.x).
> I want to move some common source files in the BSP code (that I added) into a different folder and create a shared 
library which can be accessed by the different drivers in the BSP. Currently these files are getting duplicated in the 
various drivers.
> I would appreciate any help on how this can be achieved.
>
> Thanks,
> Arun
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post65086
>
>    


-- 
*Christian W. Damus*
Software Developer, IDE Team
QNX Software Systems <http://www.qnx.com/>;
Re: Creating a Shared Library in BSP using IDE  
Thanks a lot Christian!! I was able to create the shared library.

One more question, the shared library structure creates and installs "*.so", "*S.a" and "*.so.1". Are all these files 
required to be in the install path when I am including this library in other drivers/components in BSP. 

For example, if I want to include this shared library (for example: libcommon.so) from 'devc' ('NOT' static linking), 
cant I link to 'libcommon.so' and have only the 'libcommon.so' installed in the 'lib' folder or do I require the 
'libcommonS.a' and 'libcommon.so.1' to be present there? 
If my understanding is correct, the "S.a" is for statically linking the library and '.so.1' is a version management file
.

Thanks,
Arun
Re: Creating a Shared Library in BSP using IDE  
Hi, Arun,

Sorry for the late reply.

You only need the S.a for static linking into other shared libs, and the 
versioned .so is only necessary if you need to support multiple 
applications that are linked to different versions of the library.  For 
your development purposes, that's probably not a concern.  It's only 
interesting in deployment on your target system.

So, yes, just install the .so and link with -lcommon in your linker 
command, and you should be fine.

HTH,

Christian


On 02/09/10 03:11 PM, Arun Parameswaran wrote:
> Thanks a lot Christian!! I was able to create the shared library.
>
> One more question, the shared library structure creates and installs "*.so", "*S.a" and "*.so.1". Are all these files 
required to be in the install path when I am including this library in other drivers/components in BSP.
>
> For example, if I want to include this shared library (for example: libcommon.so) from 'devc' ('NOT' static linking), 
cant I link to 'libcommon.so' and have only the 'libcommon.so' installed in the 'lib' folder or do I require the 
'libcommonS.a' and 'libcommon.so.1' to be present there?
> If my understanding is correct, the "S.a" is for statically linking the library and '.so.1' is a version management 
file.
>
> Thanks,
> Arun
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post65766
>
>    


-- 
*Christian W. Damus*
Software Developer, IDE Team
QNX Software Systems <http://www.qnx.com/>;
Re: Creating a Shared Library in BSP using IDE  
Thanks for the clarificaton Christian!! 

Regards,
Arun