| 1 | #include <iostream>
|
|---|
| 2 | #include "CFBundle.h"
|
|---|
| 3 |
|
|---|
| 4 | typedef int (* PI_Ptr)();
|
|---|
| 5 |
|
|---|
| 6 | int main (int argc, char * const argv[])
|
|---|
| 7 | {
|
|---|
| 8 | for (int i = 1; i< 100000; i++ )
|
|---|
| 9 | {
|
|---|
| 10 | std::cout << i << std::endl;
|
|---|
| 11 |
|
|---|
| 12 | CFURLRef bundleURL = CFURLCreateWithFileSystemPath(NULL, CFSTR("./bundle.plugin"), kCFURLPOSIXPathStyle, true);
|
|---|
| 13 | CFBundleRef _bundle = CFBundleCreate(kCFAllocatorDefault, bundleURL);
|
|---|
| 14 | CFRelease(bundleURL);
|
|---|
| 15 |
|
|---|
| 16 | PI_Ptr funcAddr = (PI_Ptr)CFBundleGetFunctionPointerForName(_bundle, CFSTR("main"));
|
|---|
| 17 |
|
|---|
| 18 | funcAddr();
|
|---|
| 19 |
|
|---|
| 20 | CFBundleUnloadExecutable(_bundle);
|
|---|
| 21 | CFRelease(_bundle);
|
|---|
| 22 | }
|
|---|
| 23 | return 0;
|
|---|
| 24 | }
|
|---|