Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Mohit_M_Intel
Employee
1,432 Views

How would i link new '.a' file?

Jump to solution

I have a '.a' file that I want to include in my project, how would i do that?

0 Kudos
1 Solution
Richard_A_Intel
Employee
60 Views

ISSM does support linking .a files.

For example the Accelerometer samples uses IPP which is provided as a ".a" file called: libippsq.a

Then in that project's top level Makefile we have these lines:

CFLAGS += -I$(IPP_LIBRARY_PATH)/include -D__IPP_ENABLED__=1

LDLIBS += -L$(IPP_LIBRARY_PATH)/lib -lippsq

We define the IPP_LIBRARY_PATH elsewhere but you would likely want to provide your library path here directly. The CFLAGs command tells the compiler to include the .h files in that location. We can ignore the –D, it's not need for the users question. The LDLIBS command then links the library, the ".a" file, into the project and it needs 2 things. "-L" and "-l". Another thing note is that it's standard to start your file name with "lib" when using it like this, I don't know if it's required, but it's a good practice to avoid confusion.

Thank you,

Richard

View solution in original post

4 Replies
idata
Community Manager
60 Views

Hi Mohit_07,

I have some questions about this:

  • Do you have the header file (.h) and the source code of the library (.c)?
  • Are you using ISSM, right?

To be honest, I'm not sure if it is possible to link an .a file using ISSM, because ISSM does all the compilation part. Normally when you use a library in your code you have to include the .h file (For example: # include "qm_gpio.h").

So, I think it will be easier if you have the .c and .h files.

I will be waiting for your reply.

Regards,

-Leonardo

Mohit_M_Intel
Employee
60 Views

Hi Leonardo,

I do have the .h file but no .c file. I also am using ISSM.

In ISSM, app.mk file has a linker function and I was looking at that to see how it links all of the libqmsi together.

idata
Community Manager
60 Views

Hi Mohit_07,

Let me investigate more about it, I will let you know when I have updates.

Regards,

-Leonardo

Richard_A_Intel
Employee
61 Views

ISSM does support linking .a files.

For example the Accelerometer samples uses IPP which is provided as a ".a" file called: libippsq.a

Then in that project's top level Makefile we have these lines:

CFLAGS += -I$(IPP_LIBRARY_PATH)/include -D__IPP_ENABLED__=1

LDLIBS += -L$(IPP_LIBRARY_PATH)/lib -lippsq

We define the IPP_LIBRARY_PATH elsewhere but you would likely want to provide your library path here directly. The CFLAGs command tells the compiler to include the .h files in that location. We can ignore the –D, it's not need for the users question. The LDLIBS command then links the library, the ".a" file, into the project and it needs 2 things. "-L" and "-l". Another thing note is that it's standard to start your file name with "lib" when using it like this, I don't know if it's required, but it's a good practice to avoid confusion.

Thank you,

Richard

View solution in original post

Reply