Issue
I was interested to inspect globally available modulemaps of Objective-C language under macOS and was wondering if it's possible to add one myself. Is there a way to know where a particular module (e.g. Foundation
) is located?
@import Foundation; // Where this comes from?
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSLog(@"Hello, world!");
}
return 0;
}
Solution
Almost all modules are embedded to the corresponding frameworks in the system. For the latest version of macOS at the time of writing (macOS Monterey 12.6 (21G115)) the frameworks can be found under this directory:
/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
E.g. Foundation
modulemap is located at the path /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Modules/module.modulemap
and looks like this:
framework module Foundation [extern_c] [system] {
umbrella header "Foundation.h"
export *
module * {
export *
}
explicit module NSDebug {
header "NSDebug.h"
export *
}
// Use NSItemProvider.h
exclude header "NSItemProviderReadingWriting.h"
}
The dependencies which were not part of any framework (e.g. libobjc
), however, also have modulemaps defined and available under different directory:
/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
Answered By - The Dreams Wind Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.