在使用 MSHookFunction() 的时候no matching function...?

图片里的错误

只写 MSFindSymbol() 的时候没问题

你的newC_test是怎么定义的?
改成

MSHookFunction((void *)MSFindSymbol(NULL, "c_test"), &newC_test, &oldC_test);

试试

改成

MSHookFunction((void *)MSFindSymbol(NULL, "c_test"),(void *)newC_test,(void **)oldC_test);

可以了,但是hook不上

下面是我全部的代码


#include "substrate.h"



void *(*oldC_test)(int a);

void newC_test(int a)
{
    
    NSLog(@"**************\nhook*************\n");
    
}

%ctor
{
    MSHookFunction((void *)MSFindSymbol(NULL, "c_test"),(void *)newC_test,(void **)oldC_test);
}

不知道是不是 MSFindSymbol() 方法用错了,这个是用来搜索地址的吗?

已解决改成下面这样就可以了
MSHookFunction((void *)MSFindSymbol(NULL, “_c_test”),(void *)newC_test,(void **)&oldC_test);