benoit
February 23, 2007, 7:16pm
1
Hi,
I’ve seen in the nvcc compiler there is a -lib option,
does this make a linux so compatible library ?
because I got an error when I try to import it saying : invalid ELF header
I;m working on it…
but if you guys have any clues, it would help !
thank you
benoit
February 24, 2007, 1:12am
4
Actually I thought it worked but it didn’t,
so here is my prototype :
CudaArray *CudaArray_new( uint32_t nbDim, uint32_t *shape)
and when I compile with nvcc
here is the new mane of the function : (using nm)
00006649 T _Z13CudaArray_newjPj
and I should get : 00006649 T CudaArray_new
what are _Z13 and jPj doing there ?
this happends even whem i use the -lib or the -share flag
could you tell me why ?
benoit
February 25, 2007, 3:35am
5
I finally figured out the pb :
you need to add extern “C” before the declaration,
otherwise nvcc will change the name of the function.
But now I get another problem :
I can’t get back the pointer of my cudaArray pointing into the device.
here is what I use for compiling :
nvcc -shared -c libCuda.cu -Xcompiler “-m32” -deviceemu -I/usr/local/cuda/include -DUNIX -L/usr/local/cuda/lib -lcuda -lcudart -lGL -lGLU -l cutil
gcc -o libCuda.so -shared libCuda.o -I/usr/local/cuda/include -I/home/thor/NVIDIA_CUDA_SDK/common/inc -I -DUNIX -L/usr/local/cuda/lib -lcuda -lcudart -lGL -lGLU -l cutil
I think I’m not using the correct options, how can I compile a shared object ?
thank you
Are these host or device functions you are trying to put in the .so? Host code should work fine, but you can’t make a library of device functions yet in CUDA – there is no linking support at the device level (all device functions are inlined).
Mark