Save yourself some trouble and use https://xll.codeplex.com. Complete code to register and define the function is
static AddIn12 xai_strgen(
L"?strgen", L"STRGEN",
XLL_LPOPER12, L"");
LPOPER12 WINAPI strgen()
{
#pragma XLLEXPORT
static XLOPER12 xRes(L"X");
return &xRes;
}