Closed mbazaliy closed 9 years ago
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.
I think this would be hard without more documentation about the Swift ABI, but we'll see more after Swift goes open source.
is there any progress?
@zixun Can you give a general description of what kind of functions you'd like to hook, and what your replacement function would be?
@kastiglione I want to hook print
function.because I want to get the print log data automaticly and real time~
this is the print
function define:
public func print(_ items: Any..., separator: String = default, terminator: String = default)
and my replacement function
public func printHook(_ items: Any..., separator: String = default, terminator: String = default)
Have you tried getting the mangled symbol names for each of those functions and used fishhook with those symbols?
@kastiglione yes. I tried it,but not word
If you're able to post a link to a small project, I'd be happy to take a look.
@kastiglione the demo is very little, just like this:
import UIKit
import fishhook
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let r_list = UnsafeMutablePointer<rebinding>.allocate(capacity: 1)
let r = rebinding(name: "print", replacement: my_print, replaced: &print)
r_list[0] = r;
rebind_symbols(r_list, 2)
}
}
func my_print(_ items: Any..., separator: String, terminator: String) {
print(items, separator: separator, terminator: terminator)
}
Any plans to support Swift functions ?