Skip to content

Commit

Permalink
Update demo.mg
Browse files Browse the repository at this point in the history
  • Loading branch information
YPLiang19 authored Dec 9, 2022
1 parent 07f21c3 commit c529fc5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions MangoFixDemo/MangoFixDemo/demo.mg
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,39 @@ class ViewController:UIViewController {
}


// Native 全局变量访问测试
- (void)nativeGlobalVariableAccess {

extern int nativeInt1;
extern int nativeInt2;

NSLog(@"--" + nativeInt1);
NSLog(@"--" + nativeInt2);

nativeInt2 = nativeInt1;

NSLog(@"--" + nativeInt1);
NSLog(@"--" + nativeInt2);


CFunction<void, char *> testNativeCStringFunc = CFunction("testNativeCStringFunc");

extern Pointer nativeCString1;
extern Pointer nativeCString2;

testNativeCStringFunc(nativeCString1);
testNativeCStringFunc(nativeCString2);

nativeCString2 = nativeCString1;

testNativeCStringFunc(nativeCString1);
testNativeCStringFunc(nativeCString2);


extern NSString *nativeNSString;
self.resultView.text = nativeNSString;

}

- (void)staticVarAndGetVarAddressOperExample {
static int i = 0;
Expand Down

0 comments on commit c529fc5

Please sign in to comment.