From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Emsley Newsgroups: gmane.lisp.guile.user Subject: Guile + SWIG Date: Mon, 05 Apr 2021 10:39:41 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22528"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.34.1-2 To: Guile User Mailing List Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Apr 05 18:13:33 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lTRr3-0005lG-GW for guile-user@m.gmane-mx.org; Mon, 05 Apr 2021 18:13:33 +0200 Original-Received: from localhost ([::1]:54170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lTRr2-000425-DI for guile-user@m.gmane-mx.org; Mon, 05 Apr 2021 12:13:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lTLi5-0006z5-By for guile-user@gnu.org; Mon, 05 Apr 2021 05:39:53 -0400 Original-Received: from ppsw-42.csi.cam.ac.uk ([131.111.8.142]:48088) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lTLi1-0004wr-2g for guile-user@gnu.org; Mon, 05 Apr 2021 05:39:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cam.ac.uk; s=20180806.ppsw; h=Content-Transfer-Encoding:MIME-Version:Content-Type:Date: To:From:Subject:Message-ID:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=qsnV6alt1KvOn4+vxJf0YLxcgAhoEi+OzKQh1ibJn1k=; b=e2xrQgFsh7cB8qGlO5fAlc+2Ga /dty6DNFWvGzEZUepKe7JwCancInTh2d4wdgIYMy+DWvS+9+0REONVeGun6yARTfgZaqYCVYtVGUn 7LrY8J1cYHHrMyOMpxUg9rpqK/S92LVbUm6+pn5iXcAA19vwg8QBnzskcmnmscUl17cU=; X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Original-Received: from mail.mrc-lmb.cam.ac.uk ([131.111.85.9]:57558 helo=mail.lmb.internal) by ppsw-42.csi.cam.ac.uk (ppsw.cam.ac.uk [131.111.8.138]:25) with esmtp id 1lTLhw-000MzW-87 (Exim 4.94) for guile-user@gnu.org (return-path ); Mon, 05 Apr 2021 10:39:44 +0100 Original-Received: from 79-77-210-255.dynamic.dsl.as9105.com ([79.77.210.255] helo=penelope) by mail.lmb.internal with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lTLhw-000fmH-4D for guile-user@gnu.org; Mon, 05 Apr 2021 10:39:44 +0100 Received-SPF: pass client-ip=131.111.8.142; envelope-from=pemsley@mrc-lmb.cam.ac.uk; helo=ppsw-42.csi.cam.ac.uk X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 05 Apr 2021 12:12:25 -0400 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17397 Archived-At: Hi, I am bringing my swigged Gtk2 + guile 1.8.8 + guile-gtk application up to date and I'd like some help please. My SWIG usage wraps many function, including enhanced_coot_ligand_p(). I am confused between the difference between functions that are available from C/C++ and those from a scheme script: if my inner_main looks like this: void inner_main(void *closure, int argc, char **argv) { SWIG_init(); std::string handler_string = "(lambda (key . args) "; handler_string += "(display (list \"Error in proc:\" key \" args: \" args)) (newline))"; SCM handler = scm_c_eval_string(handler_string.c_str()); std::string thunk_str = "(lambda() (display (list 444444444444444444 (enhanced-ligand-coot-p))) (newline))\n"; SCM thunk = scm_c_eval_string(thunk_str.c_str()); scm_catch(SCM_BOOL_T, thunk, handler); gtk_main(); } then I get on the terminal what I expected: (444444444444444444 #f) (i.e. enhanced-ligand-coot-p is evaluated) if my inner_main looks like this: void inner_main(void *closure, int argc, char **argv) { SWIG_init(); std::string handler_string = "(lambda (key . args) "; handler_string += "(display (list \"Error in proc:\" key \" args: \" args)) (newline))"; SCM handler = scm_c_eval_string(handler_string.c_str()); std::string thunk_str = "(use-modules (test-embedding))\n"; //////////// different /////////////// SCM thunk = scm_c_eval_string(thunk_str.c_str()); scm_catch(SCM_BOOL_T, thunk, handler); gtk_main(); } then I get: ;; compiling /home/paule/autobuild/Linux-pen-pre-release-gtk3/share/guile/site/test-embedding.scm ;;; test-embedding.scm:21:30: warning: possibly unbound variable `enhanced-ligand-coot-p' ;;; compiled /home/paule/.cache/guile/ccache/2.2-LE-8-3.A/home/paule/autobuild/Linux-pen-pre-release- gtk3/share/guile/site/test-embedding.scm.go ------------------- test embedding! ----------------------- Backtrace: 18 (apply-smob/1 #) In ice-9/boot-9.scm: 2312:4 17 (save-module-excursion _) In ice-9/eval-string.scm: 38:6 16 (read-and-eval # #:lang _) In ice-9/eval.scm: 721:20 15 (primitive-eval _) In ice-9/psyntax.scm: 1262:36 14 (expand-top-sequence _ _ _ #f _ _ _) 1209:24 13 (parse _ (("placeholder" placeholder)) ((top) #(# # …)) …) 285:10 12 (parse _ (("placeholder" placeholder)) (()) _ c&e (eval) …) In ice-9/boot-9.scm: 3377:20 11 (process-use-modules _) 222:17 10 (map1 (((test-embedding)))) 3378:31 9 (_ ((test-embedding))) 2800:17 8 (resolve-interface (test-embedding) #:select _ #:hide _ …) In ice-9/threads.scm: 390:8 7 (_ _) In ice-9/boot-9.scm: 2726:13 6 (_) In ice-9/threads.scm: 390:8 5 (_ _) In ice-9/boot-9.scm: 2994:20 4 (_) 2312:4 3 (save-module-excursion _) 3014:26 2 (_) In unknown file: 1 (primitive-load-path "test-embedding" #) In test-embedding.scm: 19:0 0 (_) test-embedding.scm:4:0: In procedure module-lookup: Unbound variable: enhanced-ligand-coot-p test-embedding.scm looks like this and is installed in $prfx/share/guile/site (display "------------------- test embedding! -----------------------\n") (display (list 55555555555555 (enhanced-ligand-coot-p))) (newline) So, inner_main() knows that enhanced-ligand-coot-p is available, but the scheme script does not. I don't know how to resolve this. How do I get a list of the available functions? Thanks in advance for your help. Paul.