Trying to use Inline::C and the ApplicationServices.h framework in Macos.
My simple code is:
#!/usr/bin/env perl
use 5.014;
use warnings;
use Inline Config => force_build => 1, clean_after_build => 0;
use Inline C => Config => libs => '-framework ApplicationServices';
use Inline C => 'DATA';
mmove(10,40);
__DATA__
__C__
#include <ApplicationServices/ApplicationServices.h>
#include <unistd.h>
void mmove(int x, int y) {
CGEventRef move = CGEventCreateMouseEvent( NULL, kCGEventMouseMoved, CGPointMake(x, y), kCGMouseButtonLeft );
CGEventPost(kCGHIDEventTap, move);
CFRelease(move);
}
Unfortunately, when running this got linking error.
dyld: lazy symbol binding failed: Symbol not found: _CGEventCreateMouseEvent
Referenced from: /Users/clt/.Inline/lib/auto/g_649d/g_649d.bundle
Expected in: flat namespace
dyld: Symbol not found: _CGEventCreateMouseEvent
Referenced from: /Users/clt/.Inline/lib/auto/g_649d/g_649d.bundle
Expected in: flat namespace
Abort trap: 6
The pure C source code:
#include <ApplicationServices/ApplicationServices.h>
#include <unistd.h>
void mmove(int x, int y);
int main() {
mmove(100,100);
}
void mmove(int x, int y) {
CGEventRef move = CGEventCreateMouseEvent( NULL, kCGEventMouseMoved, CGPointMake(x, y), kCGMouseButtonLeft );
CGEventPost(kCGHIDEventTap, move);
CFRelease(move);
}
compiled with gcc -o cl cl.c -Wall -framework ApplicationServices works as expected.
The question: How to correctly pass the -framework ApplicationServices to the Inline::C linker? (my use Inline C => Config => libs => '-framework ApplicationServices';) doesn't works. (what I missed?)