emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Abysmal state of GTK build


From: Po Lu
Subject: Re: Abysmal state of GTK build
Date: Thu, 25 Aug 2022 12:18:42 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

Richard Stallman <rms@gnu.org> writes:

> I can understand that in a general conceptual sense,
> but would you please show me how ONE function is handled,
> in the various files, and explain the crucial things in it?
> Including the C++ constructs that are used?  I don't know C++.

Take the example of the extern "C" function BAlert_new:

/* Create a BAlert with TEXT.  */
void *
BAlert_new (const char *text, enum haiku_alert_type type)
{
  return new BAlert (NULL, text, NULL, NULL, NULL, B_WIDTH_AS_USUAL,
                     (enum alert_type) type);
}

it's a wrapper around the C++ constructor for the alert dialog class
"BAlert", and returns the result of the constructor (the new instance of
the C++ class) as a pointer to void.  Conceptually, it would be the same
as:

  pointer = malloc (sizeof BAlert);
  constructor_of_balert (pointer);

  return pointer;

Then, this extern "C" function takes the resulting void pointer and
deletes it, by calling the C++ destructor:

void
BAlert_delete (void *alert)
{
  delete (BAlert *) alert;
}

> Are the C++ functions all external to Emacs?
> Exported by the operating system?

Yes.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]