Static wrapper for NPP library

Hi
I faced a problem trying to create static wrapper with some of NPP icc functions, to call them from cGo (Golang) environment. I’m able to create and compile (C language) executable, with provided static NPP libraries, and it works well. Then I compile it as a library (with necessary flags). But when I try to link that library from another executable (plain C or cGo), I get error message “undefined reference to nppiYCbCr420ToRGB_8u_P3C3R”. What I’m doing wrong?

***** wrapper.c *****

#include <nppi_color_conversion.h>
#include <cuda_runtime_api.h>

int YCbCr420ToRGB() {
NppiSize oSizeROI;

const Npp8u * const pSrc[3];
int cSrcStep[3];
Npp8u *cDst;

NppStatus ret = nppiYCbCr420ToRGB_8u_P3C3R(pSrc, cSrcStep, cDst, 0, oSizeROI);

return (int)ret; // ret = 14

}

***** build.sh *****

nvcc nppGo.c -lib -lnppicc_static -lnppc_static -lculibos -lcudart_static -lpthread -ldl -lrt -I /usr/local/cuda-10.0/include -L /usr/local/cuda-10.0/lib64 -o libnppGo

***** test.c *****

#include <stdio.h>
#include “…/nppGo.h”

int main() {
unsigned char const *Y, *Cb, *Cr;
int cSrcStep[3];
unsigned char *pDst;

int ret = YCbCr420ToRGB(Y, Cb, Cr, cSrcStep, pDst, 0, 0, 0);
printf("Return code is: %d\n", ret);

return (int)ret;

}

***** buildtest.sh *****

nvcc test.c -L . -lnppGo -o nppGo

Finally I get this error message

./libnppGo.a(tmpxft_0000204d_00000000-2_nppGo.o): In function YCbCr420ToRGB': nppGo.c:(.text+0xf9): undefined reference to nppiYCbCr420ToRGB_8u_P3C3R’
collect2: error: ld returned 1 exit status

Did you declare your wrapper as extern “C”?

I finally decided to not use .so or .a libraries. Now I use cGo to directly call NPP functions from Golang code - that works good.