File tree 1 file changed +17
-0
lines changed
collects/scribblings/foreign
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,23 @@ Defines each @racket[class-id] to the class (a value with FFI type
107
107
@examples[
108
108
#:eval objc-eval
109
109
(eval:alts (import-class NSString) (void))
110
+ ]
111
+
112
+ A class accessed by @racket[import-class] is normally declared as a
113
+ side effect of loading a foreign library. For example, if you want to
114
+ import the class @tt{NSString} on Mac OS X, the @filepath{Foundation}
115
+ framework must be loaded, first. Beware that if you use
116
+ @racket[import-class] in DrRacket or a module that @racket[require ]s
117
+ @racketmodname[racket/gui/base], then @filepath{Foundation} will have
118
+ been loaded into the Racket process already. To avoid relying on other
119
+ libraries to load @filepath{Foundation}, explicitly load it with
120
+ @racket[ffi-lib]:
121
+
122
+ @examples[
123
+ #:eval objc-eval
124
+ (eval:alts (ffi-lib
125
+ "/System/Library/Frameworks/Foundation.framework/Foundation " ) (void))
126
+ (eval:alts (import-class NSString) (void))
110
127
]}
111
128
112
129
@defform[(import-protocol protocol-id ... )]{
You can’t perform that action at this time.
0 commit comments