Announcement

Collapse
No announcement yet.

PB to C Declaration Question..

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

  • PB to C Declaration Question..

    Hey guys,

    I did this conversion of a PB Declaration to C. Is this correct?


    Code:
    C Declare
    void __stdcall BBGETHEADER(char &sMessageText,
    				char &sReturn,
    				int  &lLength
    			  );

    Code:
    PB Declare
    DECLARE SUB bbGetHeader LIB "bBounce.dll" ALIAS "BBGETHEADER" (BYREF sMessageText AS ASCIIZ, _
                    BYREF sReturn AS ASCIIZ, BYREF lLength AS LONG)
    Thanks,
    Scott

    ------------------
    Scott Wolfington
    http://www.boogietools.com



    [This message has been edited by Scott Wolfington (edited November 18, 2003).]
    Scott Wolfington
    [url="http://www.boogietools.com"]http://www.boogietools.com[/url]

  • #2
    Replace "&" with "*" and you'll be all set.


    ------------------
    Kev Peel
    http://www.kgpsoftware.com

    [This message has been edited by Kev Peel (edited November 18, 2003).]
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      Thanks Kev. Does changing them to an * make it so I don't have to call the subroutine from C like this:

      BBGETHEADER( *a, *b, len );

      With your changes, would it just be:

      BBGETHEADER( a, b, len );


      The reason I ask is because I have some code, which I've had for a very long time, where the C declaration looked like this:

      (MYFUNC is a function within a PowerBASIC Dll)

      Code:
      int  __stdcall MYFUNC(char &sMessage,
                                      char &sAddressOut,
                                      int  &lAddressLenOut,
                                      char &sIgnoreList,
                                      char &sKey
                                  );
      The C code calls the function like this:

      result = MYFUNC( *c1, *c2, len, *c3, *c4 );


      Is this correct? Is it just another way to "skin a cat"? Is one way better than the other?

      Thanks,
      Scott


      ------------------
      Scott Wolfington
      http://www.boogietools.com



      [This message has been edited by Scott Wolfington (edited November 18, 2003).]
      Scott Wolfington
      [url="http://www.boogietools.com"]http://www.boogietools.com[/url]

      Comment


      • #4
        Either way will work. Most people declare pointers with an asterisk and call it using an ampersand (this passes the variable address)

        ------------------
        Kev Peel
        http://www.kgpsoftware.com
        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

        Comment


        • #5
          Great. Thanks Kev.

          Btw, I responded to your email, but the message bounced back with this message:

          421 mk-cpfrontend.uk.tiscali.com Service not available - too busy

          Do you have another email address I can send a message too?

          Scott

          ------------------
          Scott Wolfington
          http://www.boogietools.com
          Scott Wolfington
          [url="http://www.boogietools.com"]http://www.boogietools.com[/url]

          Comment


          • #6
            Sorry about that Scott. Been having ISP problems all darn week. Please use mailATkgpsoftware.com (replace AT with @) instead.

            [removed email]

            ------------------
            Kev Peel
            http://www.kgpsoftware.com

            [This message has been edited by Kev Peel (edited May 10, 2004).]
            kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

            Comment

            Working...
            X