Skip to content

How to link with a framework on macOS ? #393

@hakonhagland

Description

@hakonhagland

See this question on stackoverflow. In order to compile the following C program on macOS :

#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);
}

the following command line can be used:

cc -o foo foo.c -framework ApplicationServices

But passing LIBS => " -framework ApplicationServices" to WriteMakefile() does not work. For example:

$ perl -MData::Dumper -MExtUtils::Liblist -E ' print Dumper(ExtUtils::Liblist->ext("-framework ApplicationServices"))'
$VAR1 = '';
$VAR2 = '';
$VAR3 = '';
$VAR4 = '';

However, passing LDDLFLAGS => "$Config{lddlflags} -framework ApplicationServices" does work, but shouldn't it be possible to use LIBS here ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions