Announcement

Collapse
No announcement yet.

Calling PB DLL from 'C'

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling PB DLL from 'C'

    Assume I have a PB DLL with the following exported method that
    has one array argument:

    MyMethod(BYVAL PBArrayIn as DWORD) EXPORT

    Then, in my PB code I map the memory to this array as follows:

    DIM PBArray(5, 3, 2) as double AT PBArrayIn

    If I want to call this method from 'C', how should I dimension
    the array that I am passing in? I was told to do the following:

    double PassedArray[2][3][5]; (dimensioned opposite as PBArray above)

    Is this right? Why?

    Thanks for you help on this!

  • #2
    That's correct - PB stores array in column-major order
    with (0,0) first, (1,0) second, etc.. whereas C stores
    arrays in row major order: (0,0),(0,1), etc...

    Cheers

    Florent

    ------------------

    Comment


    • #3
      > double PassedArray[2][3][5]; (dimensioned opposite as PBArray above)

      Be careful with that, it should be:

      double PassedArray[3][4][6]; (dimensioned opposite as PBArray above)

      Basic subscipts are default 0 to #Elements, in C you have to specify the number of elements, which is one more.


      Peter.


      ------------------
      [email protected]
      [email protected]

      Comment

      Working...
      X