Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Nicolas_G_
Beginner
22 Views

Problems building custom so

Hi,

I am trying to build a custom .so to link my C++ software against but I am having trouble.

Are there clear and detailed instructions to build a custom .so using CMake that I could find somewhere? If not, can someone guide me through the process. I have instructions for a custom dll from IPP version 6 and sample code from the IPP website but I can't make it work.

From what I understand, I need 4 files:

  1. exports.def (or .txt) containing the list of fucntions I need.
  2. funclist.h containing the declarations of the functions from the ipp*.h files.
  3. some sort of .c file (dllmain.c or init.c) to bring everything together. This is where I get lost...
  4. CMakeLists.txt to compile everything.

Are these the only files I need? What are they supposed to contain?

Thank you very much for your help!

Nicolas

0 Kudos
1 Reply
Pavel_B_Intel1
Employee
22 Views

Hi Nikolas,

as I understand you would like to build custom shared library on Linux, so I provide instructions and examples for Linux:

1) define export.txt (you can use any filename) file with exact list of IPP functions which will be exported in your library, for example:

EXTERN( ippiGetLibVersion )
EXTERN( ippsGetLibVersion )
EXTERN( ippiMalloc_16s_C1 )
EXTERN( ippiFree )
EXTERN( ippiSet_16s_C1R )
EXTERN( ippiMul_16s_C1RSfs )

VERSION {
   {
      global:
      ippiGetLibVersion;
      ippsGetLibVersion;
      ippiMalloc_16s_C1;
      ippiFree;
      ippiSet_16s_C1R;
      ippiMul_16s_C1RSfs;
      local: *;
   };
}

2) define _init() function where you should call ippInit() to initialize IPP dispatcher (main.c):

#include "ipp.h"

int _init(void)
{
   ippInit();
   return 1;
}

void _fini(void)
{
}

3) compile main.c with -fPIC option and build your shared library:

ld -shared export.txt -o libmylib.so main.o $(IPPROOT)/lib/intel64/libippi.a $(IPPROOT)/lib/intel64/libipps.a $(IPPROOT)/lib/intel64/libippcore.a -lc

That all.

Pavel