Christian Schmitz wrote:
> Tim Jones <tjmac at tolisgroup dot com> wrote:
>
>
>> Hi Folks,
>>
>> Working on a plugin being developed from a current Linux shared library
>> that requires 2 structs of shorts passed in and a third struct of shorts
>> for the results to be returned. I understand the process of passing in
>> the structs as MemoryBlocks as Ptr, and passing the third struct as a
>> memoryblock byref as a Ptr.
>>
>> My question is what type of object am I creating when I add my RB
>> function? Here's the actual function call definition:
>>
>> static void MontgomeryReduction(unsigned short *m1,
>> unsigned short *m2,
>> unsigned short *result)
>>
>> What type of the entry in the pluginMethodArray[]? For example:
>>
>> static REALmethodDefinition pluginMethodArray[] = {
>> { (REALproc) ModularExp, REALnoImplementation,
>> "ModularExp(MemoryBlock As Ptr,
>> MemoryBlock As Ptr,
>> ByRef MemoryBlock As Ptr)" },
>> };
>>
>
> "ModularExp(m1 As MemoryBlock,
> m2 As MemoryBlock,
> r As MemoryBlock)" },
>
> Just pass memoryblocks.
>
Thanks Christian. Since 'r' is going to be modified by the algorithm,
shouldn't the entry be "ByRef r As MemoryBlock"? Also, am I using the
correct identifier for this type of function (accept 3 memoryblocks,
modify the contents of the 3rd) when I use "REALNoImplementation"?
Let me see if I understand how this *should* work:
The change above works and my ModularExp() method nows autocompletes in
the IDE editor - however, the helper text does not show up in the IDE's
status bar.
When I run my code in a pushbutton's action event - a simple creation:
Dim m1 As New MemoryBlock(64*2) // 64 shorts
Dim m2 As New MemoryBlock(64*2)
Dim r As New MemoryBlock(64*2)
Dim x As Integer
For x = 0 to 63
m1.UShort(x * 2) = &hffff
m2.UShort(x * 2) = &h0000 // just to make sure
r.UShort(x * 2) = &h0000
Next
m2.UShort(0) = &h5 // run the reduction loop 5 times
ModularExp(m1, m2, r)
I get a hard crash. My first thought was that I needed to pass result
as ByRef (the contents of result() are changed to contain the result),
but I get the same error.
If I take the Plugin back to a standalone tool, the compiled app runs
with no errors.
Any thoughts or guidance on how to troubleshoot / debug this?
Tim
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
From Tue 23 Oct 2007 19:31:07 +0200
Return-Path: <realbasic-plugins-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
id 5BCB8490B6B9; Tue, 23 Oct 2007 10:31:21 -0700 (PDT)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on
www.realsoftware.com
X-Spam-Level:
X-Spam-Status: No, score=-2.5 required=4.5 tests=AWL,BAYES_00 autolearn=ham
version=3.1.1
Received: from lists.realsoftware.com (m.realsoftware.com [66.116.103.65])
by xmail.realsoftware.com (Postfix) with ESMTP id 79CC7490B6A6;
Tue, 23 Oct 2007 10:31:16 -0700 (PDT)
Received: from real-software-mini.local (localhost [127.0.0.1])
by lists.realsoftware.com (Postfix) with ESMTP id B97108117F3;
Tue, 23 Oct 2007 12:30:55 -0500 (CDT)
X-Original-To: realbasic-plugins at lists dot realsoftware dot com
Delivered-To: realbasic-plugins at lists dot realsoftware dot com
Received: from smtprelay07.ispgateway.de (smtprelay07.ispgateway.de
[80.67.29.7])
by lists.realsoftware.com (Postfix) with ESMTP id 32F448117E8
for <realbasic-plugins at lists dot realsoftware dot com>;
Tue, 23 Oct 2007 12:30:52 -0500 (CDT)
Received: (qmail 22349 invoked from network); 23 Oct 2007 17:31:07 -0000
Received: from unknown (HELO [192.168.1.80]) (363246 at [84 dot 175 dot 98 dot
215])
(envelope-sender <support at monkeybreadsoftware dot de>)
by smtprelay07.ispgateway.de (qmail-ldap-1.03) with SMTP
for <realbasic-plugins at lists dot realsoftware dot com>;
23 Oct 2007 17:31:07 -0000
To: realbasic-plugins at lists dot realsoftware dot com (REALbasic Plugins)
In-Reply-To: <471E2DD0 dot 4080101 at tolisgroup dot com>
Subject: Re: Proper declares request
From: support at monkeybreadsoftware dot de (Christian Schmitz)
Date: Tue, 23 Oct 2007 19:31:07 +0200
Message-ID: <1i6gbfg dot quyro51ilcaufM%support at monkeybreadsoftware dot de>
MIME-Version: 1.0
Organization: Monkeybread Software Germany
X-Face: nrf3>{WQ6c&r+7 at e)"]0G60`-6ND^)I2mI%>)QGYa=9"=7jhd-g2|b3!>Al0+
Ccb%xGQshhi|g at QU2$
User-Agent: MacSOUP/D-2.8 (Mac OS X version 10.4.9 (PPC))
X-BeenThere: realbasic-plugins at lists dot realsoftware dot com
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot
com>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Sender: realbasic-plugins-bounces at lists dot realsoftware dot com
Errors-To: realbasic-plugins-bounces at lists dot realsoftware dot com
Tim Jones <tjmac at tolisgroup dot com> wrote:
> Thanks Christian. Since 'r' is going to be modified by the algorithm,
> shouldn't the entry be "ByRef r As MemoryBlock"?
do you modify the reference or the content?
Byref is to modify the reference.
e.g. to assign a new memoryblock to it in the function.
> Also, am I using the =
> correct identifier for this type of function (accept 3 memoryblocks, =
> modify the contents of the 3rd) when I use "REALNoImplementation"?
looks correct.
> The change above works and my ModularExp() method nows autocompletes in
> the IDE editor - however, the helper text does not show up in the IDE's
> status bar.
You will get used to it.
=
> =
> I get a hard crash.
your C function is not declared to take REALmemoryblocks.
> Any thoughts or guidance on how to troubleshoot / debug this?
Write to the debug console.
You would than notice that your writes corrupt the memoryblock data
structure.
Gru=DF
Christian
-- =
Over 900 classes with 17000 functions in one REALbasic plug-in. =
The Monkeybread Software Realbasic Plugin v7.6. =
<http://www.monkeybreadsoftware.de/realbasic/plugins.shtml>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|