小编lij*_*jie的帖子

从 DLL 及其关联的导入库 (VS8) 中删除导出的符号

有什么方法可以对 DLL 及其 .lib 文件进行后处理以删除我不想要的符号?

背景:

DLL 的代码使用 boost::serialization,它 dllexports(很多)符号。显然,这是为了使链接器不会省略未引用但在初始化时具有重要副作用的静态对象。

但是,我非常希望 DLL 的导出符号中没有任何提升的提示。

我的理由是,既然链接步骤已经完成,那么删除由库引起的符号表中的混乱是安全的。

因此,我想知道是否存在一些工具来实现这一点。

visual-studio-2005 visual-studio

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

C++:不能将泛型函数作为参数传递给另一个函数

我想将多个比较函数传递给选择排序函数,如下所示,但我得到了以下错误:

Error   1   error C2664: 'sort' : cannot convert parameter 3 from 'bool (__cdecl *)(int,int)' to 'bool *(__cdecl *)(T,T)'   c:\users\milad\documents\visual studio 2008\projects\functionpass\functionpass\passcompare.cpp  49  FunctionPass
Run Code Online (Sandbox Code Playgroud)

代码:

bool integerCompare (int a , int b)
{
    return(a<b);
}
bool charCompare (char a , char b)
{
    return(a<b);
}
bool stringCompare (string a , string b)
{
    if(a.compare(b)<0) return true;
    else return false;
}
template <class T>
void sort(T x[], int n , bool(*whichCompare(T,T))) // n=size of the array
{
    for (int pass=0; pass<n-1; …
Run Code Online (Sandbox Code Playgroud)

c++ sorting pointers compare function-pointers

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

pcap为什么总是8字节的包...为什么?

我正在使用pcap库,但我不知道为什么我总是得到这个输出:

大小的新数据包:udata = 8 hdr = 8 pkt = 8

这是代码:

void handle_pcap(u_char *udata, const struct pcap_pkthdr *hdr, const u_char *pkt)
{
  DEBUG("DANY new packet with size: udata= %d hdr=%d pkt=%d", (int) sizeof(udata),(int) sizeof(hdr),(int) sizeof(pkt) );
...
stuff
}
Run Code Online (Sandbox Code Playgroud)

在我使用的另一个文件中:

status = pcap_loop (pcap_obj,
    -1     /* How many packets it should sniff for before returning (a negative value
       means it should sniff until an error occurs  (loop forever) ) */,
    handle_pcap  /* Callback that will be called*/,
    NULL   /* Arguments …
Run Code Online (Sandbox Code Playgroud)

c pcap

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