Can Cocoa be used in FileMaker Plugins?
I am trying to port a Windows FileMaker plugin to OS X and am thinking that I should be doi开发者_如何学Pythonng this in Cocoa not Carbon,
but I am struggling to get anything to compile as soon as I include Cocoa.h
Are you importing it into a .c file? Cocoa requires Objective-C, so you'll need to rename any files you want to import its header into from .c to .m.
Of course, how practical that is depends on FileMaker's plug-in API on the Mac (assuming it has one). If the API, including UI hooks, is entirely Carbon-based, switching the plug-in's source to Cocoa may be futile. I can't say for sure without knowing that API.
Actually the FileMaker Framework is C++. You can mix C++ and Objective-C code so you could use Cocoa instead of Carbon. Beware that the file would be .mm not .m
An Objective-C wrapper to the C++ framework would make it possible to use .m Objective-C. Unfortunately I'm totally ignorant of C++ (and expect to stay) so it is beyond my competence.
精彩评论