When I read the code in gRPC, I found many APIs using GRPCAPI
as qualifier.
GRPCAPI grpc_channel* grpc_cronet_secure_channel_create(
void* engine, const char* target, const grpc_channel_args* args,
void* reserved);
When I click the link to GRPCAPI
, it's an empty macro.
#ifndef GPRAPI
#define GPRAPI
#endif
#ifndef GRPCAPI
#define GRPCAPI GPRAPI
#endif
I understand some usages of empty macro:
- preventing multiple copies of the same header being included
- used as a switch for debug or removing sensitive code
But here the GRPCAPI
belongs to neither. Is it just a marker to tell us the function is an API? Or more effect for document or others functions?
I really appreciate the answer from @Raildex and comment from @paulsm4, which are very inspiring.
But the exactly function of
GRPCAPI
andGPRAPI
is used to mark APIs as a label.There is a script in grpc named list_api.py using the label GPRAPI and GRPCAPI, which is the only place using these two labels.
After running the script, we'll get: