From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Cedric Cellier Newsgroups: gmane.lisp.guile.user Subject: Re: Thread and guile environment Date: Mon, 12 Jul 2010 10:09:43 +0200 Message-ID: <20100712080943.GA4158@securactive.net> References: <20100705082310.GA9492@apc> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="FL5UXtIhxfXey3p5" X-Trace: dough.gmane.org 1278922245 32604 80.91.229.12 (12 Jul 2010 08:10:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 12 Jul 2010 08:10:45 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Jul 12 10:10:45 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OYE67-0004ox-5M for guile-user@m.gmane.org; Mon, 12 Jul 2010 10:10:43 +0200 Original-Received: from localhost ([127.0.0.1]:42293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYE66-0007OR-DT for guile-user@m.gmane.org; Mon, 12 Jul 2010 04:10:42 -0400 Original-Received: from [140.186.70.92] (port=54752 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYE5a-0007NM-Dj for guile-user@gnu.org; Mon, 12 Jul 2010 04:10:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYE5Z-0003It-BU for guile-user@gnu.org; Mon, 12 Jul 2010 04:10:10 -0400 Original-Received: from smtp5-g21.free.fr ([212.27.42.5]:59619) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYE5Y-0003BA-NL for guile-user@gnu.org; Mon, 12 Jul 2010 04:10:09 -0400 Original-Received: from apc.happyleptic.org (unknown [82.67.194.89]) by smtp5-g21.free.fr (Postfix) with ESMTP id 54566D4816E for ; Mon, 12 Jul 2010 10:09:41 +0200 (CEST) Original-Received: from ccellier.rd.securactive.lan (extranet.securactive.org [82.234.213.170]) by apc.happyleptic.org (Postfix) with ESMTP id 0D76733515 for ; Mon, 12 Jul 2010 10:10:34 +0200 (CEST) Original-Received: from rixed by ccellier.rd.securactive.lan with local (Exim 4.71) (envelope-from ) id 1OYE59-0001Fa-2c for guile-user@gnu.org; Mon, 12 Jul 2010 10:09:43 +0200 Mail-Followup-To: guile-user@gnu.org Content-Disposition: inline In-Reply-To: <20100705082310.GA9492@apc> User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7984 Archived-At: --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This works if I explicitely define a module _and_ export the hug symbol. --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bug.scm" (define-module (bug)) (export hug) (use-modules (ice-9 format)) (define (hug x) (format #t "HUG ~a !\n" x)) --FL5UXtIhxfXey3p5 Content-Type: text/x-csrc; charset=us-ascii Content-Disposition: attachment; filename="bug.c" #include #include #include static void *load_file_with_guile(void *filename) { scm_c_primitive_load((char *)filename); return NULL; } static void *hug_me(void *str) { scm_c_eval_string(str); } static void *thread_hugme(void *dummy) { //scm_with_guile(load_file_with_guile, "bug.scm"); scm_with_guile(hug_me, "((@ (bug) hug) 2)"); return NULL; } int main(void) { scm_with_guile(load_file_with_guile, "bug.scm"); scm_with_guile(hug_me, "((@ (bug) hug) 1)"); pthread_t thread; pthread_create(&thread, NULL, thread_hugme, NULL); pthread_join(thread, NULL); return 0; } --FL5UXtIhxfXey3p5--