From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41786 invoked by alias); 9 Jun 2015 20:57:03 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 41745 invoked by uid 89); 9 Jun 2015 20:56:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.98.7 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_40,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-Spam-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_40,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com Message-ID: <1433882972.12727.152.camel@surprise> Subject: Re: External references From: David Malcolm To: Dibyendu Majumdar Cc: jit@gcc.gnu.org Date: Thu, 01 Jan 2015 00:00:00 -0000 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-SW-Source: 2015-q2/txt/msg00037.txt.bz2 On Tue, 2015-06-09 at 21:39 +0100, Dibyendu Majumdar wrote: > If a JIT compiled function needs to call externally defined C > functions, can I define these references in the parent context and use > in child contexts? Yes: you ought to be able to declare the functions with GCC_JIT_FUNCTION_IMPORTED in the parent context to get a long-lived gcc_jit_function * object, and then call them from child contexts. I believe I did something like this when porting GNU Octave's JIT to libgccjit. I don't think there's an example of this in the docs yet (we probably should have a tutorial showing the use of a parent context for shared setup). Dave