From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hans Aberg Newsgroups: gmane.lisp.guile.user Subject: Re: Guile and C++ Date: Fri, 14 May 2010 23:06:58 +0200 Message-ID: <04136158-092D-4563-B654-DA853FD783BF@telia.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1273871239 13800 80.91.229.12 (14 May 2010 21:07:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 14 May 2010 21:07:19 +0000 (UTC) Cc: guile-user@gnu.org To: Noah Lavine Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri May 14 23:07:09 2010 connect(): No such file or directory 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 1OD265-0006EN-4T for guile-user@m.gmane.org; Fri, 14 May 2010 23:07:05 +0200 Original-Received: from localhost ([127.0.0.1]:37631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OD264-0006jr-DF for guile-user@m.gmane.org; Fri, 14 May 2010 17:07:04 -0400 Original-Received: from [140.186.70.92] (port=39432 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OD25t-0006hR-OE for guile-user@gnu.org; Fri, 14 May 2010 17:06:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OD25r-0006wD-VM for guile-user@gnu.org; Fri, 14 May 2010 17:06:53 -0400 Original-Received: from smtp-out11.han.skanova.net ([195.67.226.200]:53955) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OD25r-0006vm-Mp for guile-user@gnu.org; Fri, 14 May 2010 17:06:51 -0400 Original-Received: from h131n2-fre-d2.ias.bredband.telia.com (78.72.157.131) by smtp-out11.han.skanova.net (8.5.114) (authenticated as u26619196) id 4BC6D1B300C26920; Fri, 14 May 2010 23:06:49 +0200 In-Reply-To: X-Mailer: Apple Mail (2.936) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:7777 Archived-At: On 14 May 2010, at 22:05, Noah Lavine wrote: > How would this work if I wanted to not run Guile embedded in a C++ > program, but instead load the C++ code at runtime from a regular Guile > interpreter? (This could use either the libffi binding or the regular > Guile ones.) Since Guile is written in C, formally according to the C++ standard, you can only load Guile from C++ code, and not the opposite. So main() must be C++. GCC though has integrated C and C++ fully, it seems. So you can call C+ + from C code, but the latter do not implement C++ exception stacks, and may not call C++ initialization function properly (I haven't checked). It means that throwing and catching exceptions within C++ functions called from C seems to work fine, but if one tries to pass it through a C function, the program will throw a terminate exception. Hans