From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: taylanbayirli@gmail.com (Taylan Ulrich =?utf-8?Q?Bay=C4=B1rl=C4=B1?= =?utf-8?Q?=2FKammer?=) Newsgroups: gmane.lisp.guile.user Subject: Re: how to access c-array member in c-structure? Date: Wed, 30 Mar 2016 11:03:33 +0200 Message-ID: <87r3esxrq2.fsf@T420.taylan> References: <9FB905A2-E625-4B23-BBB3-18831A9535EC@icloud.com> <87zitgxui7.fsf@T420.taylan> <20160330080741.GA28334@tuxteam.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1459328672 4903 80.91.229.3 (30 Mar 2016 09:04:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Mar 2016 09:04:32 +0000 (UTC) Cc: guile-user@gnu.org To: Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Mar 30 11:04:32 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1alC2r-0001lN-TZ for guile-user@m.gmane.org; Wed, 30 Mar 2016 11:04:10 +0200 Original-Received: from localhost ([::1]:52689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alC2q-0000hX-WC for guile-user@m.gmane.org; Wed, 30 Mar 2016 05:04:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alC2O-0000Id-Kd for guile-user@gnu.org; Wed, 30 Mar 2016 05:03:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alC2K-0005MH-OC for guile-user@gnu.org; Wed, 30 Mar 2016 05:03:40 -0400 Original-Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alC2K-0005M9-Hf for guile-user@gnu.org; Wed, 30 Mar 2016 05:03:36 -0400 Original-Received: by mail-wm0-x244.google.com with SMTP id 20so12696311wmh.3 for ; Wed, 30 Mar 2016 02:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=wSdkizA7EOntair/7E84jdcIxBZwRPv/RpEmtuVTwF4=; b=qG7FSjijpiKKgFYqSmGkCRBdYOLo2i/7apTykSUCk2F/wSm33rOtY6bwU3LNheKLTn Jxr58EpBIkuVGc61ilP+ep7RJDzWEKhG8DrBVpNrJ6qK+tY9d8xIaMljQFW0SvQyPd6i 00AzEVOeC8bF1kPYStis2SjddRWEk5RhmuQ+214Ypu4B25GjzPW8Q5IFAQhrJJsMpTtb K0GMvaH1QgYY9qG8vIIFaYvB1aK6Uvj4B++fChjpZG0KwtRE/z4rFop6vi2+kENUChW7 CO4Vy5EOCV/wI/7mytStQbQxf62I50h3KILlo8zN7UVH/pSRfD4v+6ZIABn/d5BiZvtH 3eCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=wSdkizA7EOntair/7E84jdcIxBZwRPv/RpEmtuVTwF4=; b=ALOqayYBvm3154AHa/PyxDZxQs8sSw+k3j8ksD19mhfxWgdfSXEQvOOflPjC1kfDAp ZNBMOP6tTuXsjOaR7vgEJWPj618XGjoAvi8z34rgmr60rXGJj83Gz1MFNHEJX/whcO3I v4l+TyTMcuOS6lX/UvZM0Bq8gUN2JwvdMVdwBF5gLOlGXsp5cEpusJK/wwRivoGch5Ft SuBJ0OdJO19AYgyXaTb89rH1nUCE7jA1NfB11ugt6m6y1aTYHh7uTe+zon1GjhgECKxM N80PxQrUhi3RCzk52zLsUCeSvi0OottZuaQf2ojkx9ZuoblR2aOD7vnAhnAa5rOClm99 pFVw== X-Gm-Message-State: AD7BkJKnqawk00mH0JW1ctWD8qBudzstmHQCxHMoLpqED1SYgYbj1v6p1LFopl07SlaLWg== X-Received: by 10.194.202.195 with SMTP id kk3mr7816043wjc.159.1459328615783; Wed, 30 Mar 2016 02:03:35 -0700 (PDT) Original-Received: from T420.taylan ([2a02:908:c30:3540:221:ccff:fe66:68f0]) by smtp.gmail.com with ESMTPSA id w203sm3306409wmg.14.2016.03.30.02.03.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2016 02:03:34 -0700 (PDT) In-Reply-To: <20160330080741.GA28334@tuxteam.de> (tomas@tuxteam.de's message of "Wed, 30 Mar 2016 10:07:41 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:12524 Archived-At: writes: > On Wed, Mar 30, 2016 at 10:03:28AM +0200, Taylan Ulrich Bay=C4=B1rl=C4=B1= /Kammer wrote: >> Park SungMin writes: >>=20 >> > (let ((c-type (list int int (make-list 20000 int)))) >> > (parse-c-struct >> > ((pointer->procedure >> > c-type >> > (dynamic-func "make_foo" libfoo) >> > (list int int)) >> > 4 11) >> > c-type)) >> > >> > also run well=E2=80=A6but seems less effective.(if more bigger size=E2= =80=A62000000??)=20 >>=20 >> You could create the type object once at program startup and use it >> many times. >>=20 >> (define foo-type >> (list int int (make-list 2000000 int))) > > If I understood Park SungMin right, the problem is rather with the > representation of a huge array as a list? Oh I see. For me, the following works: (define type (list int (make-list 10 int))) (define struct (make-c-struct type (list 42 (make-list 10 42)))) (parse-c-struct struct (list int '*)) =3D> (1 #)=20 Is it different when the struct really comes from the C library? Taylan