aboutsummaryrefslogtreecommitdiff
path: root/src/Object.m
blob: 71a2a7d4c7fb43625e0f2881c068f31e789815d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <Paradox/Object.h>
#include <objc/objc.h>
#include <objc/runtime.h>
#include <stdio.h>

@implementation PXObject 

+ (instancetype)alloc {
	return class_createInstance(self, 0);
}

+ (instancetype)allocDebug {
	printf("alloc: self = %p\n", (void*)self);
	printf("alloc: instance size = %zu\n", class_getInstanceSize(self));
	printf("alloc: sizeof(Class) = %zu\n", sizeof(Class));

	id object = [self alloc];

	printf("alloc: object = %p\n", (void*)object);

	return object;
}

- (instancetype)init {
	return self;
}

- (void)dealloc {
	object_dispose(self);
}

@end