* How to link new libraries when building emacs
@ 2024-04-03 3:11 Elijah G
2024-04-03 5:52 ` Po Lu
0 siblings, 1 reply; 12+ messages in thread
From: Elijah G @ 2024-04-03 3:11 UTC (permalink / raw)
To: help-gnu-emacs
Hello, i don't know if this is a good place to ask this, i'm building
emacs with an additional library (exactly d2d1.h), however i'm getting
errors that library isn't linking, I have been looking for how to
solve it, but nothing, even i've tried searching in commits about
other libraries imported but I ended up getting lost. So If anyone
knows I would greatly appreciate it.
Also I would like to know where the font display source is stored,
specifically emoji support in Windows NT port.
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to link new libraries when building emacs
2024-04-03 3:11 How to link new libraries when building emacs Elijah G
@ 2024-04-03 5:52 ` Po Lu
2024-04-03 16:42 ` Elijah G
0 siblings, 1 reply; 12+ messages in thread
From: Po Lu @ 2024-04-03 5:52 UTC (permalink / raw)
To: Elijah G; +Cc: emacs-devel
Elijah G <eg642616@gmail.com> writes:
> Hello, i don't know if this is a good place to ask this, i'm building
> emacs with an additional library (exactly d2d1.h), however i'm getting
> errors that library isn't linking, I have been looking for how to
> solve it, but nothing, even i've tried searching in commits about
> other libraries imported but I ended up getting lost. So If anyone
> knows I would greatly appreciate it.
Unless this library exists in Windows 9X, merely linking with the
library will not suffice; it must be dynamically loaded, and its
functions avoided on systems that predate their introduction. Grepping
for "LoadLibrary" should return plenty of examples.
Also, reading
https://github.com/apitrace/dxsdk/blob/master/Include/d2d1.h
d2d1 is also a C++ library, while Emacs headers expect a C compiler and
probably cannot be made to compile otherwise without substantial effort
and creating a new burden on the rest of us, so it's not possible to
make use of its functionality unless we decide to require a C++ compiler
for the MS Windows port, and even then not without restricting calls to
C++ functions in files isolated from Emacs facilities which in turn
export C interfaces to such functionality. I'm not confident that
MinGW's C++ ABI is stable enough to support loading C++ libraries at
runtime either.
> Also I would like to know where the font display source is stored,
It's divided among w32font.c, w32uniscribe.c and hbfont.c, AFAIK.
> specifically emoji support in Windows NT port.
There's no specific support for Emoji in any of those files, I think.
Finally, emacs-devel@gnu.org is a far more suitable venue for questions
regarding Emacs development.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to link new libraries when building emacs
2024-04-03 5:52 ` Po Lu
@ 2024-04-03 16:42 ` Elijah G
2024-04-04 0:28 ` Po Lu
0 siblings, 1 reply; 12+ messages in thread
From: Elijah G @ 2024-04-03 16:42 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel
On Tue, Apr 2, 2024 at 11:52 PM Po Lu <luangruo@yahoo.com> wrote:
>
> Elijah G <eg642616@gmail.com> writes:
>
> > Hello, i don't know if this is a good place to ask this, i'm building
> > emacs with an additional library (exactly d2d1.h), however i'm getting
> > errors that library isn't linking, I have been looking for how to
> > solve it, but nothing, even i've tried searching in commits about
> > other libraries imported but I ended up getting lost. So If anyone
> > knows I would greatly appreciate it.
>
> Unless this library exists in Windows 9X, merely linking with the
> library will not suffice; it must be dynamically loaded, and its
> functions avoided on systems that predate their introduction. Grepping
> for "LoadLibrary" should return plenty of examples.
>
Thank you, I thought I had to modify autoconf files to import the library
like libjansson or windows.h, I'll test it.
> Also, reading
>
> https://github.com/apitrace/dxsdk/blob/master/Include/d2d1.h
>
> d2d1 is also a C++ library, while Emacs headers expect a C compiler and
> probably cannot be made to compile otherwise without substantial effort
> and creating a new burden on the rest of us, so it's not possible to
> make use of its functionality unless we decide to require a C++ compiler
> for the MS Windows port, and even then not without restricting calls to
> C++ functions in files isolated from Emacs facilities which in turn
> export C interfaces to such functionality. I'm not confident that
> MinGW's C++ ABI is stable enough to support loading C++ libraries at
> runtime either.
>
I don't know if there are already libraries in emacs that also are C++,
I'm trying to get support for color emojis in the NT port and the only library
that I know allows this is d2d1.h, I needed to test if it's possible with
msys2 mingw tools.
> > Also I would like to know where the font display source is stored,
>
> It's divided among w32font.c, w32uniscribe.c and hbfont.c, AFAIK.
>
Thanks.
> Finally, emacs-devel@gnu.org is a far more suitable venue for questions
> regarding Emacs development.
Thanks, I think I'll resend this to emacs-devel@gnu.org to know more
about this.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to link new libraries when building emacs
2024-04-03 16:42 ` Elijah G
@ 2024-04-04 0:28 ` Po Lu
2024-04-04 2:15 ` Elijah G
0 siblings, 1 reply; 12+ messages in thread
From: Po Lu @ 2024-04-04 0:28 UTC (permalink / raw)
To: Elijah G; +Cc: emacs-devel
Elijah G <eg642616@gmail.com> writes:
> I don't know if there are already libraries in emacs that also are C++,
> I'm trying to get support for color emojis in the NT port and the only library
> that I know allows this is d2d1.h, I needed to test if it's possible with
> msys2 mingw tools.
But if it's C++, we know it will be impossible, right?
> Thanks, I think I'll resend this to emacs-devel@gnu.org to know more
> about this.
That won't be necessary. I've already moved this thread over.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to link new libraries when building emacs
2024-04-04 0:28 ` Po Lu
@ 2024-04-04 2:15 ` Elijah G
2024-04-04 3:15 ` Po Lu
0 siblings, 1 reply; 12+ messages in thread
From: Elijah G @ 2024-04-04 2:15 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel
On Wed, Apr 3, 2024 at 6:28 PM Po Lu <luangruo@yahoo.com> wrote:
>
> Elijah G <eg642616@gmail.com> writes:
>
> > I don't know if there are already libraries in emacs that also are C++,
> > I'm trying to get support for color emojis in the NT port and the only library
> > that I know allows this is d2d1.h, I needed to test if it's possible with
> > msys2 mingw tools.
>
> But if it's C++, we know it will be impossible, right?
Yes you are right, but since d1d2.h is also made in C i think it
may be possible to import it into emacs, (except d2d1_helper headers
since they are made in pure C++ (also i'm thinking of adding another
header into emacs to add similar helper functions)),
I think it's worth a try, also I don't know if using opengl can also
achieve this.
In one of my tests i could import d2d1 into my emacs build,
this is the code that i used for this:
int
w32font_draw (struct glyph_string *s, int from, int to,
int x, int y, bool with_background)
{
HMODULE d2d = LoadLibrary ("d2d1.dll");
if (d2d)
{
#include <d2d1.h>
DEFVAR_INT ("D2D1_HEADER", VD2D1_HEADER_VALUE, doc: /*C HEADER*/);
VD2D1_HEADER_VALUE =
D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR;
}
...
It's only a test that I made to check if it's possible to import it
Without dueling with C++ and using their functions and/or variables
in C (I'm not sure where I should move this code snippet).
> > Thanks, I think I'll resend this to emacs-devel@gnu.org to know more
> > about this.
>
> That won't be necessary. I've already moved this thread over.
Thank you.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to link new libraries when building emacs
2024-04-04 2:15 ` Elijah G
@ 2024-04-04 3:15 ` Po Lu
2024-04-04 3:49 ` Elijah G
2024-04-04 6:47 ` Eli Zaretskii
0 siblings, 2 replies; 12+ messages in thread
From: Po Lu @ 2024-04-04 3:15 UTC (permalink / raw)
To: Elijah G; +Cc: emacs-devel
Elijah G <eg642616@gmail.com> writes:
> Yes you are right, but since d1d2.h is also made in C i think it
> may be possible to import it into emacs, (except d2d1_helper headers
> since they are made in pure C++ (also i'm thinking of adding another
> header into emacs to add similar helper functions)),
If this header requires a C++ compiler, I can't promise the additional
build-time requirement will be acceptable.
> It's only a test that I made to check if it's possible to import it
> Without dueling with C++ and using their functions and/or variables
> in C (I'm not sure where I should move this code snippet).
syms_of_w32font, perhaps? (It's really not I who's best-positioned to
answer such questions.)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to link new libraries when building emacs
2024-04-04 3:15 ` Po Lu
@ 2024-04-04 3:49 ` Elijah G
2024-04-04 4:25 ` Elijah G
2024-04-04 6:47 ` Eli Zaretskii
1 sibling, 1 reply; 12+ messages in thread
From: Elijah G @ 2024-04-04 3:49 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 662 bytes --]
On Wed, Apr 3, 2024 at 9:16 PM Po Lu <luangruo@yahoo.com> wrote:
>
> Elijah G <eg642616@gmail.com> writes:
>
> > Yes you are right, but since d1d2.h is also made in C i think it
> > may be possible to import it into emacs, (except d2d1_helper headers
> > since they are made in pure C++ (also i'm thinking of adding another
> > header into emacs to add similar helper functions)),
>
> If this header requires a C++ compiler, I can't promise the additional
> build-time requirement will be acceptable.
As far as i know, the header doesn't need any c++ compiler (also the dlls
are built-in in my system), my build is using gcc -g3 -O2 -gdwarf-2.
[-- Attachment #2: Type: text/html, Size: 946 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to link new libraries when building emacs
2024-04-04 3:49 ` Elijah G
@ 2024-04-04 4:25 ` Elijah G
0 siblings, 0 replies; 12+ messages in thread
From: Elijah G @ 2024-04-04 4:25 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 961 bytes --]
El mié., 3 de abril de 2024 9:49 p. m., Elijah G <eg642616@gmail.com>
escribió:
> On Wed, Apr 3, 2024 at 9:16 PM Po Lu <luangruo@yahoo.com> wrote:
> >
> > Elijah G <eg642616@gmail.com> writes:
> >
> > > Yes you are right, but since d1d2.h is also made in C i think it
> > > may be possible to import it into emacs, (except d2d1_helper headers
> > > since they are made in pure C++ (also i'm thinking of adding another
> > > header into emacs to add similar helper functions)),
> >
> > If this header requires a C++ compiler, I can't promise the additional
> > build-time requirement will be acceptable.
>
> As far as i know, the header doesn't need any c++ compiler (also the dlls
> are built-in in my system), my build is using gcc -g3 -O2 -gdwarf-2.
>
I forgot to mention, since i'm not a pure expert in C that header can be a
bit buggy or slow, however i think this thread can also be used for send
the state of the header.
>
[-- Attachment #2: Type: text/html, Size: 1738 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to link new libraries when building emacs
2024-04-04 3:15 ` Po Lu
2024-04-04 3:49 ` Elijah G
@ 2024-04-04 6:47 ` Eli Zaretskii
2024-04-04 22:47 ` Elijah G
1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2024-04-04 6:47 UTC (permalink / raw)
To: Po Lu; +Cc: eg642616, emacs-devel
> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Thu, 04 Apr 2024 11:15:43 +0800
>
> Elijah G <eg642616@gmail.com> writes:
>
> > Yes you are right, but since d1d2.h is also made in C i think it
> > may be possible to import it into emacs, (except d2d1_helper headers
> > since they are made in pure C++ (also i'm thinking of adding another
> > header into emacs to add similar helper functions)),
>
> If this header requires a C++ compiler, I can't promise the additional
> build-time requirement will be acceptable.
AFAICT, that header can be used both with a C++ compiler and a C
compiler. See the D2D_USE_C_DEFINITIONS macro in the header and how
it is set and used.
> > It's only a test that I made to check if it's possible to import it
> > Without dueling with C++ and using their functions and/or variables
> > in C (I'm not sure where I should move this code snippet).
>
> syms_of_w32font, perhaps?
No, syms_of_w32font is run during dumping. The right place is in
syms_of_w32uniscribe_for_pdumper, when 'initialized' is non-zero
(i.e. not during dumping). This assumes that using Direct2D with the
'gdi' font back-end is either impossible or doesn't make a lot of
sense anyway.
I'm guessing that using Direct2D will need a whole new font back-end,
since we'd need a different implementation of the main drawing methods
exported by the font driver.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to link new libraries when building emacs
2024-04-04 6:47 ` Eli Zaretskii
@ 2024-04-04 22:47 ` Elijah G
2024-04-05 5:18 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: Elijah G @ 2024-04-04 22:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Po Lu, emacs-devel
On Thu, Apr 4, 2024 at 12:47 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> I'm guessing that using Direct2D will need a whole new font back-end,
> since we'd need a different implementation of the main drawing methods
> exported by the font driver.
I guess so, Also it needs DirectDraw (dwrite.h) which sadly most
of their functions to draw are made in C++ AFAIS,
i think I'll need to create a new header like w32direct2d.h
I wonder how to import another C header, do i need to modify
autoconf files or something like that?.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to link new libraries when building emacs
2024-04-04 22:47 ` Elijah G
@ 2024-04-05 5:18 ` Eli Zaretskii
2024-04-05 22:53 ` Elijah G
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2024-04-05 5:18 UTC (permalink / raw)
To: Elijah G; +Cc: luangruo, emacs-devel
> From: Elijah G <eg642616@gmail.com>
> Date: Thu, 4 Apr 2024 16:47:07 -0600
> Cc: Po Lu <luangruo@yahoo.com>, emacs-devel@gnu.org
>
> On Thu, Apr 4, 2024 at 12:47 AM Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > I'm guessing that using Direct2D will need a whole new font back-end,
> > since we'd need a different implementation of the main drawing methods
> > exported by the font driver.
>
> I guess so, Also it needs DirectDraw (dwrite.h) which sadly most
> of their functions to draw are made in C++ AFAIS,
Yes, it seems so. It's the main reason we didn't try to use them in
Emacs.
> i think I'll need to create a new header like w32direct2d.h
> I wonder how to import another C header, do i need to modify
> autoconf files or something like that?.
No need to change autoconf files, just add the header and use it in
the C sources. Autoconf changes are needed only if some systems don't
have a header file, but for header files that are part of Emacs, that
cannot happen.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: How to link new libraries when building emacs
2024-04-05 5:18 ` Eli Zaretskii
@ 2024-04-05 22:53 ` Elijah G
0 siblings, 0 replies; 12+ messages in thread
From: Elijah G @ 2024-04-05 22:53 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: luangruo, emacs-devel
On Thu, Apr 4, 2024 at 11:19 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Elijah G <eg642616@gmail.com>
> > Date: Thu, 4 Apr 2024 16:47:07 -0600
> > Cc: Po Lu <luangruo@yahoo.com>, emacs-devel@gnu.org
> >
> > On Thu, Apr 4, 2024 at 12:47 AM Eli Zaretskii <eliz@gnu.org> wrote:
> > >
> > > I'm guessing that using Direct2D will need a whole new font back-end,
> > > since we'd need a different implementation of the main drawing methods
> > > exported by the font driver.
> >
> > I guess so, Also it needs DirectDraw (dwrite.h) which sadly most
> > of their functions to draw are made in C++ AFAIS,
>
> Yes, it seems so. It's the main reason we didn't try to use them in
> Emacs.
What a shame, I'll try to do a new back-end for Directdraw,
i can't promise it, but I hope I succeed.
> > i think I'll need to create a new header like w32direct2d.h
> > I wonder how to import another C header, do i need to modify
> > autoconf files or something like that?.
>
> No need to change autoconf files, just add the header and use it in
> the C sources. Autoconf changes are needed only if some systems don't
> have a header file, but for header files that are part of Emacs, that
> cannot happen.
Thanks for the info.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-04-05 22:53 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03 3:11 How to link new libraries when building emacs Elijah G
2024-04-03 5:52 ` Po Lu
2024-04-03 16:42 ` Elijah G
2024-04-04 0:28 ` Po Lu
2024-04-04 2:15 ` Elijah G
2024-04-04 3:15 ` Po Lu
2024-04-04 3:49 ` Elijah G
2024-04-04 4:25 ` Elijah G
2024-04-04 6:47 ` Eli Zaretskii
2024-04-04 22:47 ` Elijah G
2024-04-05 5:18 ` Eli Zaretskii
2024-04-05 22:53 ` Elijah G
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.