草庐IT

clnt_call

全部标签

c++ - 视觉口齿不清 : how to call functions in external C++ DLL

我有一个我编写的C++dll(native,而不是.net),我想使用VisualLisp的功能。任何人都可以指出如何执行此操作的示例,或者至少要阅读哪部分文档吗? 最佳答案 我通过为我的dll编写一个activex/COM包装器解决了这个问题,我认为这应该使将来更容易链接。在theswamp上开始一个线程从好人那里得到了一些关于如何从VisualLisp调用COM的答案。作为记录,它看起来像这样://inc++...(headerandIDLfilealsoneeded)hresulttimestwo(doublein,doubl

c++ - gcc 和 clang 抛出 "no matching function call"但 msvc (cl) 编译并按预期工作

我写了一个小的函数模板,将不同的容器连接到一个新的容器中:#include#include#include#include#includenamespaceimpl{templatevoidjoin(OutIteratoriterator,constContainer&container,constContainers&...containers){for(constauto&item:container)*iterator++=item;join(iterator,containers...);//gccandclangcannotresolvethiscall}templatevo

c++ - MS Visual C++ : When should you care about using calling conventions?

在C/C++中(具体来说,我使用的是MSVS),在什么情况下需要担心为函数定义指定调用约定?它们曾经重要吗?complied是否能够在必要时选择最佳约定(即fastcall等)。也许我的理解还不够,但我只是看不出什么时候程序员需要关心参数在堆栈上的放置顺序等问题。我也不明白为什么编译器的优化无法选择最适合该特定功能的方案。任何人都可以提供给我的任何知识都会很棒。谢谢! 最佳答案 一般而言,当您集成由不同编译器编译的代码时,调用约定很重要。例如,如果您要发布一个将由您的客户使用的DLL,您将希望确保您导出的所有函数都具有一致的、预期的

c++ - c++ : error: must use '.*' or '->*' to call pointer-to-member function in function 中的函数指针

代码片段如下。无法理解为什么会出现此错误。voidSipObj::check_each_field(){map::iteratormsg;stringstr;charname[20];boolres=false;sscanf(get_payload(),"%s%*s",name);LOGINFO(lc())second;res=(this).*sip_field();}}typedefbool(SipObj::*sip_field_getter)();staticmapsip_field_map;sip_field_getter是函数名的占位符 最佳答案

c++ - 尝试包装函数返回值时出现 "<class name> does not provide a call operator"错误

我正在尝试编写一个函数,它将一个仿函数作为参数,调用仿函数,然后返回它的返回值,并将其包装在boost::shared_ptr中。以下拒绝编译,我完全没有想法。我得到“std::vector不提供调用操作符”(大致)。我在MacOSX上使用Clang3.1。templateboost::shared_ptrReturnValueAsShared(boost::functionfunc){returnboost::make_shared(func());}这是我尝试使用它的上下文:make_shared>>>(bind(ReturnValueAsShared>,bind([afuncti

c++ - 复制省略 : move constructor not called when using ternary expression in return statement?

考虑以下示例:#includeclassobject{public:object(){printf("constructor\n");}object(constobject&){printf("copyconstructor\n");}object(object&&){printf("moveconstructor\n");}};staticobjectcreate_object(){objecta;objectb;volatileinti=1;//With#if0,object'scopyconstructoriscalled;otherwise,itsmoveconstructor

c++ - std::call_once 对非原子变量安全吗?

对于非原子变量,std::call_once会正常工作吗?考虑以下代码std::once_flagonce;intx;voidinit(){x=10;}voidf(){std::call_once(once,init);assert(x==10);}intmain(){std::threadt1(f),t2(f);t1.join();t2.join();}当call_once返回时,init中的副作用会被所有线程看到吗?关于cppreference的文档有点模糊。它只说在所有线程上std::call_once将在init完成后返回,但没有提及任何阻止x=10在init之后重新排序的内容

C++ 虚函数 : Can the linker remove entries in the virtual function table which aren't called?

这个问题是对eliminateunusedvirtualfunctions的一种跟进,这对我的兴趣来说还不够深入。问题:在定义具有虚函数的类时,编译器为虚函数表分配存储空间,并在表中存储指向函数的指针。这会导致链接器保留这些函数的代码,而不管它们是否被调用过。这可能会导致大量死代码保留在可执行文件中,即使编译器优化设置要求消除死代码也是如此。现在,如果在可执行文件中没有任何地方有特定虚函数的调用(或者换句话说,访问虚函数表的相应槽),则可以从虚函数中省略相应的函数指针表,链接器将删除该函数的代码,并可能进一步省略其他未引用的代码。显然,这不能由编译器完成,因为只有在链接时才会清楚是否调

c++ - 理解错误 "terminate called after throwing an instance of ' std::length_error' what(): basic_string::_S_create Aborted (core dumped)"

所以这是我的错误:terminatecalledafterthrowinganinstanceof'std::length_error'what():basic_string::_S_createAborted(coredumped)这是我的代码://CoderemovedstringgenerateSong(stringlist[],intnum){//Coderemoved//Coderemovedfor(i=0;i我只想知道该错误的含义,以便我知道如何修复它。我看到很多帖子都有类似的错误,但没有完全相同的。从字面上看,我才刚刚开始使用C++,而这些答案对我目前所学的知识都没有任何

windows - Ollydbg(或其他 Windows 调试器)中 GDB 的 "call"的等价物

在GDB中,我可以通过发出类似callfoo("123")的命令来调用属于我正在调试的可执行文件的一部分的函数。我如何在OllyDbg(或其他一些主要是Windows的调试器)中做同样的事情? 最佳答案 我不知道如何使用OllyDbg做到这一点,但由于您提到了其他Windows调试器,您可以在WinDbg中使用.call命令。0:001>.callABC!DoSomething(1,2)Threadissetupforcall,'g'willexecute.WARNING:Thiscanhaveseriousside-effects