Skip to content

Instantly share code, notes, and snippets.

@leehambley
Created September 21, 2010 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leehambley/719ed9df25b1361cd89d to your computer and use it in GitHub Desktop.
Save leehambley/719ed9df25b1361cd89d to your computer and use it in GitHub Desktop.
//
// 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
//
// 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
//
// Untitled
//
// Created by Lee Hambley on 9/21/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import "greeting.h"
#include <greet.h>
#include <iostream>
int main(){
greet();
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment