-4
GpuContext* ctx

struct GpuContext
{
/*Input vars*/
size_t deviceIdx;
size_t rawIntensity;
size_t workSize;
int stridedIndex;
int memChunk;
bool isNVIDIA = false;
int compMode;

/*Output vars*/
cl_device_id DeviceID;
cl_command_queue CommandQueues;
cl_mem InputBuffer;
cl_mem OutputBuffer;
cl_mem ExtraBuffers[6];
cl_program Program[2];
cl_kernel Kernels[2][8];
size_t freeMem;
int computeUnits;
std::string name;

uint32_t Nonce;

};

ctx->Program[ii].getBuildInfo((cl_int*)1);

I'm trying to run this last line of code. I provided the relevant code for the rest of the function. The ii is because the code I'm running is inside a loop. getBuildInfo is a function call from the cl_program class located here:

https://github.khronos.org/OpenCL-CLHPP/classcl_1_1_program.html

I understand I'm doing something incorrectly. What I'm trying to do is call the function getBuildInfo on the Program[ii] cl_program object. The compiler is telling me

member reference type 'cl_program' (aka '_cl_program *') is a pointer; did
  you mean to use '->'?
                    ctx->Program[ii].getBuildInfo((cl_int*)1);
                    ~~~~~~~~~~~~~~~~^
                                    ->

But Program[ii] (cl_program) is not a pointer as you can see from the struct GpuContext. Is ctx->Program[ii]->getBuildInfo((cl_int*)1); correct?

thecodingmate
  • 331
  • 6
  • 16
  • The link you provided doesn't show the definition of `cl_program`. – R Sahu Sep 02 '18 at 21:47
  • 1
    Well, the compiler says it all : `cl_program` seems to be a type alias for `_cl_program*`. This is why you need to use the operator `->` – Vivick Sep 02 '18 at 21:52
  • 1
    You could have removed almost all of the members of `GpuContext` and still shown the problem. Don’t make people wade the irrelevant details to help you out. – Pete Becker Sep 02 '18 at 22:08

1 Answers1

2

cl_program is simply a typedef for _cl_program* where _cl_program is a struct. As a result, Program[ii] is, in fact, a pointer, and the error message is well-justified.

nanofarad
  • 40,330
  • 4
  • 86
  • 117