Create a library(.lib or .a) from e2 studio


I am trying to create a user defined library using e2tudio ISDE.

1)What are the steps i need to follow to create my own library(.lib or .a) and how to add the same in to my project.

2)Is it possible to add g_sf_el_nx NetX Port Ether on sf_el_nx and g_nx NetX on nx components to the library?

Thank you

  • 1) This is all controlled in the linker.

    • To create library select LIB (system or user) as the output of the linker rather than executable (.abs, whatever). There are some restrictions, but these are covered in the manuals.
    • to add to project, add it as input to the linker

    2) Depends on whether you have the source or  a link-able library file. In some case you can add a library as input to your user library project, and certainly you can adds source to your library build project.

    hope this helps.

  • In reply to Kevin:

    Hi kevin,

    Thanks for the reply.

    I tried to create by changing the output as static library and i am able to create a library file with .a Thanks for that.

    Following is the query i have regarding the second point.

    • For the library(sample.lib) which i am trying to create i want to add  g_sf_el_nx NetX Port Ether on sf_el_nx and g_nx NetX on nx

     components.(I will create a new thread and i'll just add frameworks and the components as mentioned in the user manual)

    • sample.lib contains a function(tcp_test()) which initializes TCP sockets and does TCP send and Receive.
    • I will add sample.lib to my project
    • I will call tcp_test() function from my project.
    • As the library contains the ethernet and Netx componets will it be able to access ethernet and TCP API's?

    In that way is it possible?

    Thank you

  • In reply to Supreet:

    For item 2, let me give an analogy that you can actually test if you want to see how this works.

    If I build a static library that uses the sinf() function from standard mathf library, my static library would then include a function call to sinf() that would be resolved at link time in the application. Thus the application build would have to include the standard library mathf as part of its build.

    So   g_sf_el_nx NetX Port Ether on sf_el_nx and g_nx NetX on nx are in a linkable library, yes your static library could call them BUT it would opnly include a function call, not the actual code. So, like above example, the application would need to include that library as part of the build. They would not be "instantiated" directly in your sample.lib (as you called it).

    If you have the source for those functions, you could build them directly into your static library (assuming the licensing allowed it).

    Again some of this depends on the exact tool chain and licensing model.

    Hope this make sense.