OK,
I'm answering my own question. You just have to extern "C" the main
function call:
extern "C" pascal OSErr HelloWorld(BBXTCallbackBlock *callbacks,
WindowPtr w, long flags, AppleEvent* event, AppleEvent* reply)
{
...
}
That gets it to work.
So, now the follow up question: How the heck do you debug a plugin?
I'd love to run it in a debugger, but I don't really see how to do
that. printf/cout tracing doesn't seem possible as there's no
terminal.
While I'm very experienced with C/C++ programming in a variety of
situations (embedded and Linux are my primary fields), I'm fairly new
to the Mac API and BBEdit plugins specifically. All of this passing
around of opaque Handles and use of pascal-style strings has me fairly
confused. So, is there a concise tutorial of what a Handle is, how to
copy the data to/from standard C or C++ strings, what the best
practices in this are?
Thanks,
- Steve
On Fri, Apr 2, 2010 at 4:03 PM, Steve deRosier <[email protected]> wrote:
> I'm trying to write a plugin for BBEdit. The SDK sample is in C, but
> I'd like to use C++ as there's some existing higher-level
> functionality I'd like to connect with my plugin. I see the Python
> language module is in C++ (or at least is contained in .cp files), so
> I assume it's possible, but if I compile my plugin as C++, when I use
> it in BBEdit, BBEdit segfaults.
>
> Does anyone know:
>
> 1. Is it possible to write a BBEdit plugin in C++?
> 2. If so, what's the proper incantation to make it work? Best would
> be if someone could give me an idea of how to go from the HelloWorld
> plugin in the SDK to a version that compiles in C++.
>
> Thanks,
> - Steve
>
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
To unsubscribe, reply using "remove me" as the subject.