TYPE and array question 
Author Message
 TYPE and array question

Just cutting and pasting some junk from VB to PBDLL6 and encountered the
following error:

TYPE Chromosome
    Curve() AS DOUBLE   '<--- Integer constant expected
    TradeCount AS LONG
    Records AS LONG
    Fitness AS DOUBLE
    Sharpe AS DOUBLE
    StopLoss AS DOUBLE
    Volatility AS DOUBLE
    Periods AS INTEGER
END TYPE

I need the double array in this TYPE. I don't think this has anything to do
with a UNION, does it?



Sun, 23 Nov 2003 06:56:39 GMT  
 TYPE and array question
DUH. never mind ;-)
Curve(1 to ...) AS DOUBLE
VB lets you leave this empty ()

Richard


Quote:
> Just cutting and pasting some junk from VB to PBDLL6 and encountered the
> following error:

> TYPE Chromosome
>     Curve() AS DOUBLE   '<--- Integer constant expected
>     TradeCount AS LONG
>     Records AS LONG
>     Fitness AS DOUBLE
>     Sharpe AS DOUBLE
>     StopLoss AS DOUBLE
>     Volatility AS DOUBLE
>     Periods AS INTEGER
> END TYPE

> I need the double array in this TYPE. I don't think this has anything to
do
> with a UNION, does it?



Sun, 23 Nov 2003 07:00:53 GMT  
 TYPE and array question
Don't feel bad. I've been trying to tell PB for about three years that
calling "tables" in UDTs "arrays" was a Bad Thing. (Ever since they put this
into PB/DOS lo these many years ago).

Note that NONE of the PB "ARRAY SORT|SCAN|INSERT|DELETE" commands work on
these so-called arrays, nor do UBOUND, LBOUND or REDIM.

If PB had not just blindly called these things "arrays" because that's what
a certain major BASIC language development tool out of  Redmond WA called
them, there would be a boatload less confusion.

--
Michael Mattias
Tal Systems
Racine WI USA


Quote:
> DUH. never mind ;-)
> Curve(1 to ...) AS DOUBLE
> VB lets you leave this empty ()



Sun, 23 Nov 2003 08:56:31 GMT  
 TYPE and array question
You can do the following, to Pass the Array from VB to PB

<Code>
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''
'Declare this Type in both VB and PB
 TYPE Chromosome
     Curve AS Long
     TradeCount AS LONG
     Records AS LONG
     Fitness AS DOUBLE
     Sharpe AS DOUBLE
     StopLoss AS DOUBLE
     Volatility AS DOUBLE
     Periods AS INTEGER
 END TYPE
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''
'VB Code
Dim MyCromosome as Chromosome
Dim MyCurve(n to m) as Double

With MyChromosome
    .Curve = Varptr(MyCromosome(0))
    ....
End With

Call MyFunction(MyChromosome,n,m)

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''
'PB Code
 Function MyFunction(Cromosmome as Chromosome, Byval lBoundCurve as Long,
Byval uBoundCurve as Long) export as Long 'or whatever you want
    Dim MyChromosome(lBoundCurve To uBoundCurve) as Chromosome AT
Chromosome.Curve

End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''
</CODE>

This is not very elegant, but it works for me

Regards



Quote:
> Just cutting and pasting some junk from VB to PBDLL6 and encountered the
> following error:

> TYPE Chromosome
>     Curve() AS DOUBLE   '<--- Integer constant expected
>     TradeCount AS LONG
>     Records AS LONG
>     Fitness AS DOUBLE
>     Sharpe AS DOUBLE
>     StopLoss AS DOUBLE
>     Volatility AS DOUBLE
>     Periods AS INTEGER
> END TYPE

> I need the double array in this TYPE. I don't think this has anything to
do
> with a UNION, does it?

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


Sun, 23 Nov 2003 18:53:28 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Question about array ops on arrays of types of arrays of ...(ack)

2. Very basic questions about class ARRAY and FILE-types

3. Array range type for Verdix Ada83 compiler question.

4. array type conversio question

5. Derived type pointer array memory management questions

6. efficiency question: type versus array

7. data type question (mix array and mapping?)

8. Allocatable arrays in Type definition (Fortran 90 question)

9. Question about arrays of derived types and POINTERs

10. Arrays as return types in JacL, Question

11. member types and array-element-type?

12. Array scan in type declared array

 

 
Powered by phpBB® Forum Software