objc_trace icon indicating copy to clipboard operation
objc_trace copied to clipboard

Unable to run Makefile & include in my project

Open irfan-cloudnix opened this issue 7 years ago • 1 comments

Thank for great article & the code to trace method calls on objective-c. but i'm facing some issues while running makefile, request you to provide steps to include your library into my project.

Below is the error i'm getting while running your Makefile

ldid -Sent.xml libobjc_trace.dylib make: ldid: No such file or directory make: *** [libobjc_trace] Error 1

And also if I directly include the objc_trace.m file into my project, i'm unable to understand how to include & invoke the method to start tracing the calls.

irfan-cloudnix avatar May 24 '18 11:05 irfan-cloudnix

I have a bad habit of responding to year old issues, but here’s some info on how it’s initialized.

If you look around like 503? If my memory serves here on mobile, you will see a static initializer or attribute(constructor()).

C constructors like this are invoked prior to an application entering main(). And you technically do not need to do anything else to initialize it. Constructors can have priority settings when you declare them starting at 101 up, as 0-100 are reserved by the compiler? If I recall correctly.

But there is no need for “initializing” this code, it’s designed to do so with the use of that constructor, such that if you make it into the dylib like the makefile intended, simply including the library will invoke the code within the constructor block.

TRGoCPftF avatar Jan 23 '20 08:01 TRGoCPftF