Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

origin返回什么值? #35

Closed
netstu opened this issue Oct 22, 2017 · 3 comments
Closed

origin返回什么值? #35

netstu opened this issue Oct 22, 2017 · 3 comments

Comments

@netstu
Copy link

netstu commented Oct 22, 2017

其中一个issue中提到按实际hook的方法进行返回,这些我基本知道怎么回事了,即,原方法返回值是什么类型,则hook返回什么类型

我现在想问的是,
例子中返回值类型为void的,都是直接return
,返回值是String的有的反回null或""

一。origin中的返回质到底有什么用?是随意写吗,有什么影响呢?影响什么?

二。hook,origin,原函数 这几个执行的流程是什么?我大概知道一些,但还是有些不太清楚

@svengong
Copy link

一,如果不理解原理,保持类型一致即可,值任意
二,如果不理解art函数调用的逻辑,讲不清楚

@netstu
Copy link
Author

netstu commented Oct 23, 2017

我不了解,所以问问啊,给点关键词或者链接我自己查一下

@rk700
Copy link
Member

rk700 commented Oct 31, 2017

  1. origin返回值任意,只要origin方法签名正确,能够编译通过即可
  2. hook()调用origin(),origin()被替换为原方法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants