Question about extend C

If we write a extend C, we can use #include <TH/TH.h> and#include <THC/THC.h>
Can we call the “function” just like the THCUNN abs.c does

void THNN_(Abs_updateOutput)(
           THCState *state,
           THCTensor *input,
           THCTensor *output)
  THCUNN_assertSameGPU(state, 2, input, output);
  THCTensor_(resizeAs)(state, output, input);
  THC_pointwiseApply2(state, output, input, absupdateOutput_functor<real>());

I rewrite the abs as a extend C (just for example):

#include <THC/THC.h>
extern THCState *state;
int abs_forward_gpu(THCudaTensor *input, THCudaTensor *output)
//    THCUNN_assertSameGPU(state, 2, input, output);
    THCudaTensor_resizeAs(state, output, input);
    THC_pointwiseApply2(state, output, input, absupdateOutput_functor());

And it seems can not include the file <THCApply.cuh>

Maybe, it is silly to ask this question (we can “copy” the form like THC_pointwiseApply2 in this .c file). However, I want to know is there a method to call the function in the libarary which is not in #include <THC/THC.h> and <TH/TH.h>

thank you advance~

THCApply.cuh probably needs to be included manually.

Did you try:

#include <THC/THCApply.cuh>

Thank you @smth . However, it can not find this file of <THC/THCApply.cuh> in extend C function .(Is this due to the torch.utils.ffi.create_extension,? it seems only TH/TH.h and THC/THC.h is explicity declare in this function ).

And TH/TH.h have the #include "THTensorDimApply.h" so it can use TH_TENSOR_APPLY3() marco. THCApply.cuh is not in THC/THC.h.

Is there a good way to “include” this header ?