public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* Libgccjit detection
@ 2023-08-09 17:45 Li, Yicheng
  2023-08-09 19:31 ` David Malcolm
  0 siblings, 1 reply; 3+ messages in thread
From: Li, Yicheng @ 2023-08-09 17:45 UTC (permalink / raw)
  To: jit

Hi,

Is there a way to detect libgccjit within C code?
I’m trying to compile the program without “-lgccjit”, but I load the corresponding PATH and LD_LIBRARY_PATH.

Thank you
Yicheng Li

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Libgccjit detection
  2023-08-09 17:45 Libgccjit detection Li, Yicheng
@ 2023-08-09 19:31 ` David Malcolm
  2023-08-09 19:35   ` Li, Yicheng
  0 siblings, 1 reply; 3+ messages in thread
From: David Malcolm @ 2023-08-09 19:31 UTC (permalink / raw)
  To: Li, Yicheng, jit

On Wed, 2023-08-09 at 17:45 +0000, Li, Yicheng via Jit wrote:
> Hi,
> 
> Is there a way to detect libgccjit within C code?

I'm not sure what you mean here, sorry.

If you want the ability to compile a source file containing gcc_jit_*
calls, but want to make having libgccjit.h optional at compile-time,
then presumably you need your project to have some kind of configure
test that determines if ligccjit is available, sets up a macro define,
and to wrap your calls to gcc_jit_* in some kind of
  #if HAVE_LIBGCCJIT 
to use the macro.

For specific features within libgccjit.h, I've tried to add a 

#ifdef LIBGCCJIT_HAVE_name_of_feature

as I add them.  For example, there's a:

#ifdef LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks

which could be used to wrap calls to that specific function.

> I’m trying to compile the program without “-lgccjit”, but I load the
> corresponding PATH and LD_LIBRARY_PATH.

Did the above answer your question, or did I misunderstand?

Dave


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Libgccjit detection
  2023-08-09 19:31 ` David Malcolm
@ 2023-08-09 19:35   ` Li, Yicheng
  0 siblings, 0 replies; 3+ messages in thread
From: Li, Yicheng @ 2023-08-09 19:35 UTC (permalink / raw)
  To: David Malcolm; +Cc: jit

Hi,

Adding the macro is what I’ve done.

Thank you
Yicheng Li

> On Aug 9, 2023, at 3:31 PM, David Malcolm <dmalcolm@redhat.com> wrote:
> 
> On Wed, 2023-08-09 at 17:45 +0000, Li, Yicheng via Jit wrote:
>> Hi,
>> 
>> Is there a way to detect libgccjit within C code?
> 
> I'm not sure what you mean here, sorry.
> 
> If you want the ability to compile a source file containing gcc_jit_*
> calls, but want to make having libgccjit.h optional at compile-time,
> then presumably you need your project to have some kind of configure
> test that determines if ligccjit is available, sets up a macro define,
> and to wrap your calls to gcc_jit_* in some kind of
>  #if HAVE_LIBGCCJIT 
> to use the macro.
> 
> For specific features within libgccjit.h, I've tried to add a 
> 
> #ifdef LIBGCCJIT_HAVE_name_of_feature
> 
> as I add them.  For example, there's a:
> 
> #ifdef LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks
> 
> which could be used to wrap calls to that specific function.
> 
>> I’m trying to compile the program without “-lgccjit”, but I load the
>> corresponding PATH and LD_LIBRARY_PATH.
> 
> Did the above answer your question, or did I misunderstand?
> 
> Dave
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-09 19:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-09 17:45 Libgccjit detection Li, Yicheng
2023-08-09 19:31 ` David Malcolm
2023-08-09 19:35   ` Li, Yicheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).