Posts

Post marked as solved
10 Replies
4.1k Views
I see Big Sur has put all the system provided libraries, including libc, into a built in dynamic linker cache. For some reason this cache is not visible to ld. This means using ld with -lc does not work as it used to. There is a work around where you can use -L to add a path to the copy of the libraries that come with XCode, but does that mean anyone who wants to use the compiled program will need to have XCode installed? Even if XCode is not required, I was wondering; what is the official Apple approved method for a C program to link against a library in the new dynamic linker cache? It seems to me that ld with -lc should do this automatically. But if the official answer is to use dlopen, then how does a command line C application call dlopen unless it can link against the system library to gain access to dlopen? What am I not understanding about the new way of doing things?
Posted Last updated
.
Post marked as solved
8 Replies
745 Views
I am currently using sigaction to trap bad memory access errors but it is really slow. What I do is call sigaction at the start of an assembly language routine to enable my signal handler and then in my signal handler I use the address of the bad memory access to determine which error message I want to return to the user. All my assembly language routines use the exact same type of exit and return values to make this possible. It is really slow. Something like 100 times slower. What would be better is if I could set up my handler once and then not have to worry about other things changing my handler, like when I call 3rd party functions in shared libraries or call operating system functions. Is there a better way?
Posted Last updated
.