macdriver icon indicating copy to clipboard operation
macdriver copied to clipboard

Generator change: keep Objective-C type when parameter is a pointer to a pointer

Open programmingkidx opened this issue 2 years ago • 1 comments

In Objective-C a method's parameter can be used to return information. This information could be anything from error info to an array of objects. Because of the complexity of the translation system, using a Go type to return this information will probably not work. I suggest a new rule be implemented in the generator that prevents the translation of an Objective-C type to a Go type when the parameter is a pointer to a pointer.

Examples of methods that would be effected by this new rule:

- NSNib's instantiateWithOwner:(id)owner topLevelObjects:(NSArray * _Nullable *)topLevelObjects
- NSFileManager's createDirectoryAtPath:(NSString *)path withIntermediateDirectories:(BOOL)createIntermediates attributes:(NSDictionary<NSFileAttributeKey, id> *)attributes error:(NSError * _Nullable *)error
- NSURLConnection's sendSynchronousRequest:(NSURLRequest *)request returningResponse:(NSURLResponse * _Nullable *)response error:(NSError * _Nullable *)error;
- IOUSBHostPipe's sendControlRequest:(IOUSBDeviceRequest)request error:(NSError * _Nullable *)error;

programmingkidx avatar Dec 08 '23 18:12 programmingkidx

Implemented this pull request for resolving this issue: https://github.com/progrium/macdriver/pull/244

programmingkidx avatar Jan 15 '24 17:01 programmingkidx