server icon indicating copy to clipboard operation
server copied to clipboard

How stub methods are using?

Open alxmamaev opened this issue 1 year ago • 2 comments

I'm trying to get up how everything works in underhood, so can you please explain how stub methods in core code are using for? I thought it might be used when we want to compile server frontend, without recompiling the whole core, but I'm not sure.

And also, why stub notation is completely different from their read declaration? For example in tritonserver.h its looks that

TRITONSERVER_DECLSPEC TRITONSERVER_Error* TRITONSERVER_ApiVersion(
    uint32_t* major, uint32_t* minor);

The function returns a pointer and gets a pointer to numbers.

But in stubs its looks that:

TRITONAPI_DECLSPEC void
TRITONSERVER_ApiVersion()
{
}

It's not return anything and also has no arguments.

Sorry, if this question is more about C++ than about triton, but I really confused about how to google it.

alxmamaev avatar Sep 03 '22 21:09 alxmamaev

Hi @alxmamaev, I'm not really an expert here but I think this is something called stub shared library, which can be used to link against with some certain interfaces provided by a real library but don't have the actual code. This helps us avoid porting file content modification for different platform. CC @GuanLuo to correct me if I'm wrong.

krishung5 avatar Sep 08 '22 16:09 krishung5

@krishung5 Yes, but how it possible to link real function call to the stubs? Them have a completely different interface: stubs never returns anything, and never have an arguments

alxmamaev avatar Sep 09 '22 23:09 alxmamaev

Closing due to inactivity. Please let us know if you would like to reopen this issue for follow-up.

dyastremsky avatar Aug 01 '23 20:08 dyastremsky