Wrapper functions


Joined
Apr 14, 2020
Messages
4
Reaction score
0
Hey guys, I am trying to write a wrapper for this function:

Code:
BOOL8 GetOwnerNo(UCHAR* pItemNoStr, UINT16 maxLen)
{
  strncpy(reinterpret_cast<char*>(pItemNoStr), GetOwnerNoString(), maxLen - 1);

  pItemNoStr[maxLen - 1] = 0;

  return ValidData;
}

Here is the definition for the function:

Code:
extern BOOL8  GetOwnerNo( UCHAR* pItemNoStr, UINT16 maxLen );

So I believe a "wrapper" is just a function that basically points to another function, correct? On that note, after importing the header for the above function into my header file, I wrote this:

Code:
virtual BOOL8 GetOwnerNo(UCHAR* pItemNoStr, UINT16 maxLen);

and in the C++ file I created this definition:

Code:
  BOOL8 ConsoleManager::GetOwnerNo(UCHAR* pItemNoStr, UINT16 maxLen)
  {
    return GetOwnerNo(pItemNoStr, maxLen);
  }

which obviously gives me this warning:

Semantic Issue
175:3: warning: all paths through this function will call itself

Which means it's trying to call itself. Which I get, but am I just supposed to rename this "wrapper"? Is that how "wrappers" work?
 
Last edited:
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top