相关疑难解决方法(0)

有没有办法在C++函数中获取函数名?

我想实现一个函数跟踪器,它将跟踪一个函数执行的时间.我有以下课程: -

class FuncTracer
{
    public:
        FuncTracer(LPCTSTR strFuncName_in)
        {
            m_strFuncName[0] = _T('\0');
            if( strFuncName_in ||
                _T('\0') != strFuncName_in[0])
            {   
                _tcscpy(m_strFuncName,strFuncName_in);

                TCHAR strLog[MAX_PATH];
                _stprintf(strLog,_T("Entering Func:- <%s>"),m_strFuncName);
                LOG(strLog)

                m_dwEnterTime = GetTickCount();
            }
        }

        ~FuncTracer()
        {
            TCHAR strLog[MAX_PATH];
            _stprintf(strLog,_T("Leaving Func:- <%s>, Time inside the func <%d> ms"),m_strFuncName, GetTickCount()-m_dwEnterTime);
            LOG(strLog)
        }

    private:
        TCHAR m_strFuncName[MAX_PATH];
        DWORD m_dwEnterTime;
};

void TestClass::TestFunction()
{
    // I want to avoid writing the function name maually..
    // Is there any macro (__LINE__)or some other way to 
    // get the function …
Run Code Online (Sandbox Code Playgroud)

c++ macros profiling

26
推荐指数
3
解决办法
4万
查看次数

使用DEF从Visual Studio 2010中的DLL导出函数

我继承了一个庞大的C++多项目解决方案,其中包含许多动态库但没有任何动态库

__declspec(dllexport)
Run Code Online (Sandbox Code Playgroud)

了解到一个人不一定要插入任何dllexport(会有很多工作),但除了相应的.dll之外,还可以使用.def文件.

为了尝试我从这里建立一个"DLL Hello World"项目,从标题中删除了dllexport并且......拼命地失败了.用已引用的页面来说,我的关键问题是如何

"[..] use the .def file when building the DLL."
Run Code Online (Sandbox Code Playgroud)

我的.def文件是(我只使用Add方法尝试代码):

LIBRARY   MathFuncsDll
EXPORTS 
?Add@MyMathFuncs@MathFuncs@@SANNN@Z
Run Code Online (Sandbox Code Playgroud)

在Visual Studio 2010中构建DLL以便导出Add方法时如何使用它?

c++ dll visual-studio-2010

7
推荐指数
1
解决办法
1万
查看次数

导出DLL C++类,关于.def文件的问题

我想在我的项目中使用隐式链接,而nmake确实想要一个.def文件.问题是,这是一个类,我不知道在exports部分写什么.有人能指出我正确的方向吗?

错误消息如下:

NMAKE:U1073:不知道如何制作'DLLCLASS.def'

PS:我正在尝试使用Windows CE Platform Builder构建.

c++ nmake function build windows-ce

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×3

build ×1

dll ×1

function ×1

macros ×1

nmake ×1

profiling ×1

visual-studio-2010 ×1

windows-ce ×1