XLL.DOC fails to write CHM when EXCEL12 is defined

Jan 3, 2014 at 11:13 PM
Edited Jan 3, 2014 at 11:43 PM
Dear all,

The chm file is not written when I uncomment #define EXCEL12 in header.h.

This is still a hunch as I wasn't able to identify the link.

What I noticed, however, is that the AddinX::addin_list& l only iterates through 3 functions:
xai_alert_filters
xai_paste_basic
xai_paste_create
and then throws an exception
__vfptr = 0x0f4649f8 const std::runtime_error::`vftable'
_Mywhat = 0x0c6b7008 "file: ..\xll\maml\document.cpp
line: 505
function: xll_make_doc
ensure: "cf_map.size() > 0" failed"
None of those functions are part of my code.

The code in question is the follwing:
#ifdef _DEBUG
// Generate the various files Sandcastle needs.
extern "C" int __declspec(dllexport) WINAPI
xll_make_doc(void)
{
    std::basic_string<TCHAR> cwd;

    try {
        cwd = Current::Directory<TCHAR>();

        // put files for C:\<path>\module.xll into C:\<path>\module\.
        std::basic_string<TCHAR> dir = to_string<XLOPERX>(ArgsX::GetName());
        std::basic_string<TCHAR> module = module_name(dir.c_str());

        // directory to use for docs
        dir.erase(dir.find_last_of(_T('.')));
        // remove previous output
        if (exists(dir.c_str()))
            rmdir_(dir.c_str());
        CreateDirectory(dir.c_str(), 0);
        SetCurrentDirectory(dir.c_str());
    
        CreateDirectory(_T("xmlcomp"), 0);
        CreateDirectory(_T("dduexml"), 0);

        // remove old help file
        DeleteFile((dir + _T(".chm")).c_str());

        // create the Sandcastle menagerie of files
        AddInX::addin_list& l(AddInX::List());

        // category -> function_text -> Args pointer
        cat_fun_map cf_map;
        for (AddInX::addin_iter i = l.begin(); i != l.end(); ++i) {
            if ((*i)->Args().TopicId()) {
                ensure ((*i)->Args().Category().xltype == xltypeStr);
                cf_map[(*i)->Args().Category()][(*i)->Args().Sort()] = &((*i)->Args());

                write_aml((*i)->Args());
                write_xmlcomp((*i)->Args()); // companion file
            }
        }

        ensure (cf_map.size() > 0);

        write_manifest(cf_map);
        write_toc(cf_map);
        write_alias(cf_map);
        write_map(cf_map);
        write_metadata(cf_map);

        build_conceptual(module.c_str());
    }
    catch (const std::exception& ex) {
        XLL_ERROR(ex.what());

        return 0;
    }

    Current::Directory<TCHAR>().Set(cwd.c_str());

    return 1;
}
I read all documentation, samples, discussions in xll.CodePlex and in Wilmott forums and it seems that keithalewis/kimosabe doesn't have all the answers about Sandcastle.

Any hint is welcome. Specially, if someone had been able to generate the chm file with EXCEL12 would be good to know so we can discard this a cause.

This is a fabulous feature. Having written chm by hand in the past, I know what I'm talking about. On my experience, documentation took me as much time as developing. Hopefully I can speed up documentation as well with Sandcastle.

For the time being I will try generating all the same functions in my EXCEL4 version, run the file and drop it in the EXCEL12 version. I did a quick test and works.

I will keep you posted.

All the best,

OttoW
Coordinator
Jan 4, 2014 at 6:51 AM
Eric Woodruff has all the answers when it comes to Sandcastle. You should consider contributing to his project if you find it useful. I sent him $100. Every little bit helps.
You have figured out the solution. Build for EXCEL4 to generate the documentation. It will work with EXCEL12 builds too.
I've been enjoying rewriting my library to leverage off the latest C++2011 goodness. https://xll8.codeplex.com.
I need to get in line with Eric's latest goodness too. XLL.DOC was my first attempt at understanding it. I should just generate the files SHFB needs and leverage off of his tools.
Code doesn't write itself. See http://xllblog.wordpress.com/ and continue to pleasantly pester me to improve my code. Your feedback has been spot on.