-
-
Save leehambley/719ed9df25b1361cd89d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// wrapper file, calls Greeting::Greet via Objective-C | |
// | |
#if __cplusplus | |
extern "C" { | |
#endif | |
#include <CoreFoundation/CoreFoundation.h> | |
#include <iostream> | |
void greet() { | |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
Greeting *g = [[Greeting alloc] init]; | |
[g autorelease]; | |
[g greet]; | |
[pool release]; | |
std::cout << "Hello Steve!" << std::endl; | |
} | |
#if __cplusplus | |
} | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Greeting.h | |
// Untitled | |
// | |
// Created by Lee Hambley on 9/21/10. | |
// Copyright 2010 __MyCompanyName__. All rights reserved. | |
// | |
#import <Cocoa/Cocoa.h> | |
@interface Greeting : NSObject { | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Untitled | |
// | |
// Created by Lee Hambley on 9/21/10. | |
// Copyright 2010 __MyCompanyName__. All rights reserved. | |
// | |
#import "greeting.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void greet(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <greet.h> | |
#include <iostream> | |
int main(){ | |
greet(); | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment