小编Sea*_*ine的帖子

如何调试从外部应用调用的类库?

有一个执行C#脚本的外部工作流,可以使用DLL文件(我的类库).

是否可以将调试附加到我的类库项目中,这样一旦这个WF调用它就会遇到断点?

谢谢

c# debugging class-library visual-studio visual-studio-debugging

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

用于基于任务的并行性的通用c ++ 11函数包装器

我正在实现一个工作窃取算法,并正在编写一个通用的函数包装器,它将promise作为包装器模板的可变参数之一.我想用这些函数包装器创建任务,并使每个节点使用promises与依赖节点进行通信.每个节点都维护一个依赖节点和承诺/期货的列表.每个节点都可以通过检查是否已设置所有期货来运行.promises可以根据函数包装器返回不同对象的作业而变化.如果单个算法可以分解为单独的操作,如读取消息和解码消息,则对对象执行检查,返回所有检查的结果,这些操作中的每一个都将返回不同的promise(对象,布尔值,结果).

这本书,C++ Concurrency in Action,有一个函数包装器实现,但是它没有处理这个用例.在网上的其他参考文献中,我看到过像std :: promise这样的承诺的硬编码引用,它只是一种类型.

有人可以建议我如何编写一个包装器来实现以下目的......

void add(int a, int b, std::promise<int>&& prms)
{
   int res = a + b;
   try {
      prms.set_value(res);
   }
   catch(...)
   {
      prms.set_exception(std::current_exception());
   }
}

int main()
{
   std::promise<int> prms;
   std::future<int> fut = prms.get_future();
   FunctionWrapper myFunctor(a, 10, 20, std::move(prms));

   // add the functor to the queue and it will be retrieved by a thread
   // that executes the task. since i have the future, i can pass it to the 
   // dependent …
Run Code Online (Sandbox Code Playgroud)

c++ c++11

5
推荐指数
1
解决办法
1299
查看次数

C++ 函数参数中的指针与引用

我想知道如何让函数改变两个变量(返回和另一个变量),我偶然发现在参数(我理解是指参数的地址)之前用“&”调用函数,然后在整个函数中,用'*'符号引用它(我猜这是一个“取消引用”,意味着它改变了地址处的对象)。

不管怎样,这一切都很好,然后有朋友说你可以直接用变量调用函数,在header中用&前面的变量引用变量,并在整个函数中正常对待它。这似乎更容易,那么为什么网络上没有更多关于它的信息呢?一种风格比另一种更正确吗?

void foo(int &junk)  //The way the friend said
{
    junk++;
}

void oof(int *junk) //what I found, and what the internet seems full of
{
    (*junk)++;
}

int main ()
{
    int junk=1;
    std::cout << junk << "\n";
    foo(junk);
    std::cout << junk << "\n";
    oof(&junk);
    std::cout << junk;
}
Run Code Online (Sandbox Code Playgroud)

这输出:

1
2
3
Run Code Online (Sandbox Code Playgroud)

所以一切正常,我想。

c++ pointers

5
推荐指数
1
解决办法
5062
查看次数

错误LNK2019:未解析的外部符号"public:void __thiscall

我的任务是编写代码以使用递归跟踪已排序的链表.我们得到了类和文件的组成,但需要填写函数.我收到了四个错误,我认为这些错误是在公共函数中调用私有函数引起的.我的错误是:

1>SortedList.obj : error LNK2019: unresolved external symbol "public: void __thiscall SortedList::recursiveMakeEmpty(class NodeType * &)" (?recursiveMakeEmpty@SortedList@@QAEXAAPAVNodeType@@@Z) referenced in function "public: void __thiscall SortedList::makeEmpty(void)" (?makeEmpty@SortedList@@QAEXXZ)
1>SortedList.obj : error LNK2019: unresolved external symbol "public: bool __thiscall SortedList::recursiveInsert(class NodeType * &,int)" (?recursiveInsert@SortedList@@QAE_NAAPAVNodeType@@H@Z) referenced in function "public: bool __thiscall SortedList::insert(int)" (?insert@SortedList@@QAE_NH@Z)
1>SortedList.obj : error LNK2019: unresolved external symbol "public: bool __thiscall SortedList::recursiveDelete(class NodeType * &,int)" (?recursiveDelete@SortedList@@QAE_NAAPAVNodeType@@H@Z) referenced in function "public: bool __thiscall SortedList::deleteItem(int)" (?deleteItem@SortedList@@QAE_NH@Z)
1>SortedList.obj : error LNK2019: unresolved external symbol "public: void __thiscall …
Run Code Online (Sandbox Code Playgroud)

c++ visual-studio-2010 lnk2019

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

windbg中的十六进制到十进制

看起来WinDbg的默认值是以十六进制显示十进制和无符号整数的整数.有没有办法以十进制显示全部?

我尝试使用这里提到n命令

它给了我语法错误:

:086> n[10]
      ^ Syntax error in 'n[10]'
Run Code Online (Sandbox Code Playgroud)

知道我做错了什么吗?

hex windbg decimal

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