Quick observations:
1) You cannot have templates as C -> JS barrier, only non-templated
functions are possible.
2) Remember to wrap the function declarations in extern "C" { void foo(); }
to avoid C++ name mangling from occurring.Jukka 2014-03-13 0:58 GMT+02:00 wolfviking0 <[email protected]>: > Hi, > > I am playing with Cuda and Emscripten, and I have some trouble with this > syntax : transformKernel<<<dimGrid, dimBlock, 0>>>(dData, width, height, > angle); > > It's the part who call the cuda kernel. For solve the problem I was > thinking make an custom emscripten function, unfortunately the function can > take N arguments and any type. > > I was trying to solve that using a function template inside an header > file, and write the code in my library_cuda.js > > The header file is : > > template<typename T0,typename T1,typename T2,typename T3> > extern int cudaRunKernelDim4(const char * kernel_name, const char * > kernel_source, const char* option, dim3 blocksPerGrid, dim3 > threadsPerBlock, int num_args, T0 P0, T1 P1, T2 P2, T3 P3); > > The c++ code give : > > #ifdef __EMSCRIPTEN__ > cudaRunKernelDim4<float*,unsigned int,unsigned int, > float>("transformKernel", transformKernel, "", dimGrid, dimBlock , 4, > dData, width, height, angle); > #else > transformKernel<<<dimGrid, dimBlock, 0>>>(dData, width, height, angle); > #endif > > The JS code is : > > cudaRunKernelDim: function(kernel_name, kernel_source, options, > blocksPerGrid, threadsPerBlock, num_args, P1, P2, P3, P4, P5, P6, P7, P8, > P9, P10) { > .... > } > cudaRunKernelDim4: 'cudaRunKernelDim', > > But when I build it with emscripten I have an unresolved symbol : > > *warning: unresolved symbol: > _Z14cudaRunKernelDim4IPfS0_S0_iEiPKcS2_S2_iiiT_T0_T1_T2_* > > *What I am doing wrong ?? * > > *Alon do you have any suggestion ??* > > *Thanks* > > *Tony* > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
