Announcement

Collapse
No announcement yet.

Passing arrays between 'C' and PB

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

  • Guest's Avatar
    Guest replied
    Sandy,

    Can I pass a 3 dimensional array from a 'C' program to a PB DLL?
    What would the declaration look like for that method if I was
    passing the array by value?
    From your last statement in your post, how can you be sure
    the dll accepts this type of array???? PB does not pass or,
    "accept"(to my knowledge), arrays "byval", "byref" only. Why
    would you even want to do this in C/C++ instead of passing
    a pointer?

    What about if I was passing a dynamically allocated array
    (using 'new' in 'C') by reference?
    This is the way to go. I would type cast the pointer in front of
    the new operator: (whatever*) new whatever. As you probably
    know, don't forget to "delete" the object you created.

    Thanks for the help. I inherited the PB DLL and I have no
    documentation to help me out and no previous experience with PB.
    I would post the dll name and what it does on this forum. The
    PB guys are very good in responding to posts. The party that
    created this dll might see and be able to respond, on the basis
    that the dll is legal in your care of course!!!

    There is another way to incorporate a PowerBasic dll in C/C++.
    Peter Stephensen and I did a short course on this a few months
    back. Search the forum for "lib" and you should find it. This
    procedure allows creating a LIB for linking at "load-time".
    You need the exported procedure info though.

    Hope this helps!

    Cheers,
    Cecil

    Addendum: Hey dude, from your original post, you were describing
    a dll created by PB not the main program itself. Please be more
    specific in the future about what you are doing!!!!

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


    [This message has been edited by Cecil Williams (edited May 10, 2001).]

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Originally posted by Lance Edmonds:
    Sandy, your last statement caught my eye.

    Is this "inherited copy" a legal licensed copy of PB/DLL? If so, it originally came with a help file. If not, please contact PowerBASIC Sales Dept to obtain a fully licensed copy of the compiler. mailto:[email protected][email protected]</A>

    Thanks!

    Lance,

    It is a licensed copy (someone left the company which is how
    I 'inherited' it) and it does have help, but I did not find any
    info regarding arrays between 'C' and PB...

    Maybe I should take another look at the help (?)...


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

    Leave a comment:


  • Lance Edmonds
    replied
    Sandy, your last statement caught my eye.

    Is this "inherited copy" a legal licensed copy of PB/DLL? If so, it originally came with a help file. If not, please contact PowerBASIC Sales Dept to obtain a fully licensed copy of the compiler. mailto:[email protected][email protected]</A>

    Thanks!

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected]sic.com[email protected]</A>

    Leave a comment:


  • Guest's Avatar
    Guest started a topic Passing arrays between 'C' and PB

    Passing arrays between 'C' and PB

    I now know (thanks to earlier responses to an e-mail I posted)
    that PB arrays are stored column major order and have one
    additional index for each dimension in the array then a 'C'
    array does.

    Now I have 2 additional questions:

    Can I pass a 3 dimensional array from a 'C' program to a PB DLL?
    What would the declaration look like for that method if I was
    passing the array by value?

    What about if I was passing a dynamically allocated array
    (using 'new' in 'C') by reference?

    Thanks for the help. I inherited the PB DLL and I have no
    documentation to help me out and no previous experience with PB.

    ------------------
Working...
X