Announcement

Collapse
No announcement yet.

C++: char * & int* = PB: ????

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

  • C++: char * & int* = PB: ????

    I'm working on attempting to convert some DLL functions written in C++ to PB.

    here is an example C++ Function:
    int iPG(char* szBuffer, int* pnBuffSize)

    Is this the correct:
    Function iPG alias "iPG" (szBuffer as ASCIIZ POINTER, pnBuffSize as INTEGER POINTER) export as INTEGER

    If you can't tell, I'm a bit confused =)

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

  • #2
    I think:

    Function iPG alias "iPG" (szBuffer as ASCIIZ, pnBuffSize as long ) export as long

    Since pnBuffSize is now BYREF, the pointer of the pnBuffSize variable is now present in c.
    This way you can modify it's contents from within c.

    This also applies to the asciiz but for the asiiz it's unclear what size it is.
    Prob. pnBuffSize = SizeOf( szBuffer ) ??


    ------------------
    http://www.hellobasic.com
    Freeware and commercial tools for PowerBASIC
    PBSoft - Netherlands

    [This message has been edited by Edwin Knoppert (edited February 20, 2004).]
    hellobasic

    Comment


    • #3
      Thanks, I'll give that a try.

      Any idea on this one:

      C++:
      void iPLG_Transition (HDC hCurPage, HDC hNextPage, SIZE sizeImage, POINT ptOffset, HWND hWindow, char* szSettings)

      PB:
      FUNCTION iPLG_Transition ALIAS "iPLG_Transition" (hCurPage AS DWORD, hNextPage as DWORD, sizeImage AS ?????, ptOffset AS ????, hWindow AS DWORD, szSettings AS ASCIIZ) EXPORT

      Can I use POINT and SIZE as they are defined int eh Win32API.INC?

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

      Comment


      • #4
        C only passes parameters BYVAL. PB defaults to BYREF, so be sure to
        use the BYVAL keyword as necessary: (BYVAL hCurPage AS DWORD,
        etc.

        SIZE and POINT from Win32API will work, but the names have been changed
        to avoid keyword conflicts: apiSIZE and POINTAPI. Not quite consistent,
        I'm afraid, but nothing you can't figure out with a quick file search.

        ------------------
        Tom Hanlin
        PowerBASIC Staff

        Comment

        Working...
        X