Multiple packages are already supported, but only as if each packages were bound in isolation. This CL lets a bound package refer to other bound packages in its exported functions, types and fields. In Java, the JNI class jclass and constructor jmethodID are exported so other packages can construct proxies of other packages' interfaces. In ObjC, the class @interface declarations are moved from the package .m file to its .h file to allow other packages to constructs its interface proxies. Add a supporting test package, secondpkg, and add Java and ObjC tests for the new cross package functionality. Also add simplepkg for testing corner cases where the generated Go file must not include its bound package. While we're here, stop generating Go proxy types for struct types; only Go interfaces can be implemented in the foreign language. Change-Id: Icbfa739c893703867d38a9100ed0928fbd7a660d Reviewed-on: https://go-review.googlesource.com/20575 Reviewed-by: David Crawshaw <crawshaw@golang.org>
46 lines
891 B
Plaintext
46 lines
891 B
Plaintext
// Objective-C API for talking to issue12328 Go package.
|
|
// gobind -lang=objc issue12328
|
|
//
|
|
// File is generated by gobind. Do not edit.
|
|
|
|
#include <Foundation/Foundation.h>
|
|
#include "seq.h"
|
|
#include "_cgo_export.h"
|
|
#include "GoIssue12328.h"
|
|
|
|
static NSString* errDomain = @"go.issue12328";
|
|
|
|
@protocol goSeqRefInterface
|
|
-(GoSeqRef*) _ref;
|
|
@end
|
|
|
|
|
|
@implementation GoIssue12328T {
|
|
}
|
|
|
|
- (id)initWithRef:(id)ref {
|
|
self = [super init];
|
|
if (self) { __ref = ref; }
|
|
return self;
|
|
}
|
|
|
|
- (NSString*)err {
|
|
int32_t refnum = go_seq_go_to_refnum(self._ref);
|
|
nstring r0 = proxyissue12328_T_Err_Get(refnum);
|
|
NSString *_r0 = go_seq_to_objc_string(r0);
|
|
return _r0;
|
|
}
|
|
|
|
- (void)setErr:(NSString*)v {
|
|
int32_t refnum = go_seq_go_to_refnum(self._ref);
|
|
nstring _v = go_seq_from_objc_string(v);
|
|
proxyissue12328_T_Err_Set(refnum, _v);
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
__attribute__((constructor)) static void init() {
|
|
init_seq();
|
|
}
|