Announcement

Collapse
No announcement yet.

Passing Parameters

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

  • Passing Parameters

    I have a few odd questions, but from the docs
    Parameter restrictions

    PowerBASIC compilers have a limit of 32 parameters per FUNCTION. To pass more than 32 parameters to a FUNCTION, construct a User-Defined Type (UDT) and pass the UDT by reference (BYREF) instead.
    Ok so that is straight forward (no more than 32 parameters

    Fixed-length strings, ASCIIZ strings, and User-Defined Types/Unions may also be passed as BYVAL or OPTIONAL parameters, now. Try to avoid passing large items BYVAL, as it’s terribly inefficient, and there is a maximum size limit of 64 Kb for a given parameter list.
    Ok I got that ... If meaning that I have 3 parameters, all being strings, the combined size can not exceed 64Kb (or 64,000 * 1024) and each character is 1 byte
    But if I have 2 parameters, say 1 string, and 1 DWORD.... then does that mean my limitation of 64Kb (or 64,000 * 1024) now means 1 byte per character, and 4 bytes per DWORD and add those values together????

    Example: If I have a function that takes 32 parameters, and each is a DWORD, and I pass to each parameter the same number of bytes, would my limit be (64,000 * 1024) / 32
    ???

    Maybe I am mis-understanding, but maybe I got it right???
    Engineer's Motto: If it aint broke take it apart and fix it

    "If at 1st you don't succeed... call it version 1.0"

    "Half of Programming is coding"....."The other 90% is DEBUGGING"

    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

  • #2
    But if I have 2 parameters, say 1 string, and 1 DWORD.... then does that mean my limitation of 64Kb (or 64,000 * 1024) now means 1 byte per character, and 4 bytes per DWORD and add those values together????
    A dynamic string is not the same that a fixed-length string or an asciiz string. When you pass a dynamic string by value, a pointer (4 bytes) to the string data is passed, not the string data.

    Example: If I have a function that takes 32 parameters, and each is a DWORD, and I pass to each parameter the same number of bytes, would my limit be (64,000 * 1024) / 32
    ???
    32 parameters * 4 (the size of a DWORD) = 128 bytes
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      I think that the restriction is in the combined size of size of all the parameters actually passed, rather than the data referenced by them. DWORDs would be passed either BYVAL (4 bytes) or BYREF (4 bytes), so the maximum size of a a parameter list comprising 32 DWORDs cannot exceed 4*32. The limit would only be encountered when passing strings or large UDTs by value.

      José, you beat me to it by 1 minute!
      Chris Holbrook
      Member
      Last edited by Chris Holbrook; 5 Sep 2008, 06:21 PM. Reason: see last paragraph.

      Comment


      • #4
        Good Catch Guys....I missed that part
        Although I pass a string.....what is passed is a pointer to that string.....so essentially I could pass billions of characters, but in reality pass 3 pointers to each string (being 4 bytes passed)

        Maybe an overexaggeration....but I get the jist

        At least it helps clear my head a bit (and tells me I am barking up the wrong tree solving other problems )

        Speaking of other problems, since Jose is about (I think Chris has already tried to help me with this one, but worth a look)

        Could you guys take a look at Invalid Memory Locations
        I know I am probably mixing and matching questions, but they are related, where when I have working code of pictures in a RTF in a richedit, it crashes as soon as I add PB TRACE to the code

        This is partly what led me to the quote of the 64Kb limit....but was not sure if apples vs oranges or "Every timeI open my Fridge, my truck outside starts, but I have my keys in my pocket???"
        Engineer's Motto: If it aint broke take it apart and fix it

        "If at 1st you don't succeed... call it version 1.0"

        "Half of Programming is coding"....."The other 90% is DEBUGGING"

        "Document my code????" .... "WHYYY??? do you think they call it CODE? "

        Comment


        • #5
          When you pass a dynamic string by value, a pointer (4 bytes) to the string data is passed, not the string data.
          Unless I remember it wrong......

          Only if the called function is looking for ASCIIZ. (or if this is brand M BASIC). When using PB and you pass a STRING by value to a function expecting a STRING in that position, it passes the 32-bit handle by value instead of pointer to handle.

          If the target procedure wants ASCIIZ in that position, you get a pointer to the string data (or maybe to a copy of the string data).

          The compiler kind of "helps" by handling the STRING/ASCIIZ differences for you instead of errorring out the compile on a data type mismatch, which is either a good thing or a bad thing.

          MCM
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            The compiler kind of "helps" by handling the STRING/ASCIIZ differences for you instead of errorring out the compile on a data type mismatch, which is either a good thing or a bad thing.
            Yeah its a mixed bag, cause I often see another language call my PB DLL and try to determine if a problem is because I caused it??? or if the user mis-used the call and did not know it???
            Engineer's Motto: If it aint broke take it apart and fix it

            "If at 1st you don't succeed... call it version 1.0"

            "Half of Programming is coding"....."The other 90% is DEBUGGING"

            "Document my code????" .... "WHYYY??? do you think they call it CODE? "

            Comment


            • #7
              Speaking of other problems, since Jose is about (I think Chris has already tried to help me with this one, but worth a look)

              Could you guys take a look at Invalid Memory Locations
              I know I am probably mixing and matching questions, but they are related, where when I have working code of pictures in a RTF in a richedit, it crashes as soon as I add PB TRACE to the code
              This version (for PB9) doesn't crash in my computer.

              Note: I have used the IUnknown datatype a lot to avoid to have to post many more interface definitions and structures.

              Code:
              #COMPILE EXE
              #DIM ALL
              #INCLUDE "win32api.inc"
              
              %EM_SETOLECALLBACK = %WM_USER + 70
              %EM_STREAMIN       = %WM_USER + 73
              %EM_STREAMOUT      = %WM_USER + 74
              %SF_TEXT           = &H0001
              %SF_RTF            = &H0002
              
              DECLARE FUNCTION CreateILockBytesOnHGlobal LIB "OLE32.DLL" ALIAS "CreateILockBytesOnHGlobal" ( _
                 BYVAL DWORD _                       ' [in] HGLOBL hGlobal
               , BYVAL LONG _                        ' [in] BOOL fDeleteOnRelease
               , BYREF IUnknown _                    ' [out] ILockBytes** ppLkbyt
               ) AS LONG                             ' HRESULT
              
              DECLARE FUNCTION StgCreateDocfileOnILockBytes LIB "OLE32.DLL" ALIAS "StgCreateDocfileOnILockBytes" ( _
                 BYVAL IUnknown _                    ' [in] ILockBytes* plkbyt
               , BYVAL DWORD _                       ' [in] DWORD grfMode
               , BYVAL DWORD _                       ' [in] DWORD reserved
               , BYREF IUnknown _                    ' [out] IStorage** ppstgOpen
               ) AS LONG                             ' HRESULT
              
              ' ========================================================================================
              ' Main
              ' ========================================================================================
              FUNCTION WINMAIN ( BYVAL hCurInstance  AS LONG, _
                                 BYVAL hPrevInstance AS LONG, _
                                 BYVAL lpszCmdLine   AS ASCIIZ PTR, _
                                 BYVAL nCmdShow      AS LONG ) AS LONG
              
              'TRACE NEW "RichCom with Trace.txt"          'Uncomment to create problem
              'TRACE ON                                    'Uncomment to create problem
              
                 LOCAL a             AS LONG
                 LOCAL hDlg          AS LONG
                 LOCAL Result        AS LONG
                 LOCAL hLib_RichEdit AS LONG
              
                 hLib_RichEdit = LoadLibrary("RICHED32")
              
                 DIALOG NEW 0, "RichCom, a richeditbox using it's com interface..",,, 340, 280 _
                      ,  %WS_OVERLAPPED _
                      OR %WS_SYSMENU _
                      OR %WS_MINIMIZEBOX _
                      OR %WS_MAXIMIZEBOX _
                      OR %WS_THICKFRAME _
                      OR %WS_CLIPSIBLINGS _
                      OR %WS_CLIPCHILDREN _
                      TO hDlg
              
                 IF hDlg = 0 THEN EXIT FUNCTION
              
                 CONTROL ADD "RichEdit", hDlg, 100, "", 0, 0, 118, 104,  _
                         %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_VSCROLL OR %ES_LEFT OR %ES_AUTOVSCROLL OR %ES_MULTILINE OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE
              
                 SendMessage hDlg, %WM_SIZE, 0, 0
              
                 LOCAL pRichEditOleCallback AS IRichEditOleCallbackImpl
                 pRichEditOleCallback = CLASS "CRichEditOleCallback"
                 SendMessage GetDlgItem(hDlg, 100), %EM_SETOLECALLBACK, 0, OBJPTR(pRichEditOleCallback)
              
                 DIALOG SHOW MODELESS hDlg CALL DlgProc TO Result
              
                 RichCom_LoadFromFile GetDlgItem(hDlg, 100), "Test.rtf"
              
                 DIALOG SHOW MODAL hDlg CALL DlgProc TO Result
              
                 FreeLibrary hLib_RichEdit
              
                 FUNCTION = 1
              
              'TRACE OFF                                   'Uncomment to create problem
              'TRACE CLOSE                                 'Uncomment to create problem
              
              END FUNCTION
              ' ========================================================================================
              
              ' ========================================================================================
              ' Main dialog callback
              ' ========================================================================================
              CALLBACK FUNCTION DlgProc() AS LONG
              
                 LOCAL rc AS RECT
              
                 SELECT CASE CBMSG
              
                    CASE %WM_SIZE
                       IF IsIconic(CBHNDL) THEN EXIT SELECT
                       GetClientRect CBHNDL, rc
                       MoveWindow GetDlgItem(CBHNDL, 100), 0, 0, rc.nRight, rc.nBottom, 1
              
                 END SELECT
              
              END FUNCTION
              ' ========================================================================================
              
              
              ' ########################################################################################
              ' IRichEditOleCallback interface
              ' IID = 00020D03-0000-0000-C000-000000000046
              ' Inherited interface = IUnknown
              ' ########################################################################################
              
              '/*
              ' *   IRichEditOleCallback
              ' *
              ' *   Purpose:
              ' *      Interface used by the RichEdit to get OLE-related stuff from the
              ' *      application using RichEdit.
              ' */
              
              TYPE OLEINPLACEFRAMEINFO
                 cb            AS DWORD   ' UINT
                 fMDIApp       AS LONG           ' BOOL
                 hwndFrame     AS DWORD   ' HWND
                 haccel        AS DWORD   ' HACCEL
                 cAccelEntries AS DWORD   ' UINT
              END TYPE
              
              TYPE CHARRANGE
                 cpMin AS LONG   ' LONG   cpMin
                 cpMax AS LONG   ' LONG   cpMax
              END TYPE
              
              $IID_IRichEditOleCallback = GUID$("{00020D03-0000-0000-C000-000000000046}")
              
              CLASS CRichEditOleCallback
              
              INTERFACE IRichEditOleCallbackImpl $IID_IRichEditOleCallback
              
                 INHERIT IUnknown
              
                 ' =====================================================================================
                 METHOD GetNewStorage ( _                      ' VTable offset = 12
                   BYREF lplpstg AS IUnknown _                 ' LPSTORAGE FAR * lplpstg
                 ) AS LONG                                     ' HRESULT
              
                   LOCAL hr AS LONG
                   LOCAL pILockBytes AS IUnknown ' ILockBytes
                   hr = CreateILockBytesOnHGlobal(%NULL, %TRUE, pILockBytes)
                   IF FAILED(hr) THEN METHOD = hr : EXIT METHOD
                   hr = StgCreateDocfileOnILockBytes(pILockBytes, _
                        %STGM_SHARE_EXCLUSIVE OR %STGM_READWRITE OR %STGM_CREATE, _
                        0, lplpstg)
                   METHOD = hr
              
                 END METHOD
                 ' =====================================================================================
                 METHOD GetInPlaceContext ( _                  ' VTable offset = 16
                   BYREF lplpFrame AS IUnknown _               ' LPOLEINPLACEFRAME FAR * lplpFrame
                 , BYREF lplpDoc AS IUnknown _                 ' LPOLEINPLACEUIWINDOW FAR * lplpDoc
                 , BYREF lpFrameInfo AS OLEINPLACEFRAMEINFO _  ' LPOLEINPLACEFRAMEINFO lpFrameInfo
                 ) AS LONG                                     ' HRESULT
              
                   METHOD = %E_NOTIMPL
              
                 END METHOD
                 ' =====================================================================================
                 METHOD ShowContainerUI ( _                    ' VTable offset = 20
                   BYVAL fShow AS LONG _                       ' BOOL fShow
                 ) AS LONG                                     ' HRESULT
              
                   METHOD = %E_NOTIMPL
              
                 END METHOD
                 ' =====================================================================================
                 METHOD QueryInsertObject ( _                  ' VTable offset = 24
                   BYREF lpclsid As GUID _                     ' LPCLSID lpclsid
                 , BYVAL lpstg AS IUnknown _                   ' LPSTORAGE lpstg
                 , BYVAL cp AS LONG _                          ' LONG cp
                 ) AS LONG                                     ' HRESULT
              
                   METHOD = %S_OK
              
                 END METHOD
                 ' =====================================================================================
                 METHOD DeleteObject ( _                       ' VTable offset = 28
                   BYVAL lpoleobj AS IUnknown _                ' LPOLEOBJECT lpoleobj
                 ) AS LONG                                     ' HRESULT
              
                 END METHOD
                 ' =====================================================================================
                 METHOD QueryAcceptData ( _                    ' VTable offset = 32
                   BYVAL lpdataobj AS IUnknown _               ' LPDATAOBJECT lpdataobj
                 , BYREF lpcfFormat AS DWORD _                 ' CLIPFORMAT FAR * lpcfFormat
                 , BYVAL reco AS DWORD _                       ' DWORD reco
                 , BYVAL fReally AS LONG _                     ' BOOL fReally
                 , BYVAL hMetaPict AS DWORD _                  ' HGLOBAL hMetaPict
                 ) AS LONG                                     ' HRESULT
              
                   METHOD = %E_NOTIMPL
              
                 END METHOD
                 ' =====================================================================================
                 METHOD ContextSensitiveHelp ( _               ' VTable offset = 36
                   BYVAL fEnterMode AS LONG _                  ' BOOL fEnterMode
                 ) AS LONG                                     ' HRESULT
              
                   METHOD = %E_NOTIMPL
              
                 END METHOD
                 ' =====================================================================================
                 METHOD GetClipboardData ( _                   ' VTable offset = 40
                   BYREF lpchrg AS CHARRANGE _                 ' CHARRANGE FAR * lpchrg
                 , BYVAL reco AS DWORD _                       ' DWORD reco
                 , BYREF lplpdataobj AS IUnknown _             ' LPDATAOBJECT FAR * lplpdataobj
                 ) AS LONG                                     ' HRESULT
              
                   METHOD = %E_NOTIMPL
              
                 END METHOD
                 ' =====================================================================================
                 METHOD GetDragDropEffect ( _                  ' VTable offset = 44
                   BYVAL fDrag AS LONG _                       ' BOOL fDrag
                 , BYVAL grfKeyState AS DWORD _                ' DWORD grfKeyState
                 , BYREF pdwEffect AS DWORD _                  ' LPDWORD pdwEffect
                 ) AS LONG                                     ' HRESULT
              
                   METHOD = %E_NOTIMPL
              
                 END METHOD
                 ' =====================================================================================
                 METHOD GetContextMenu ( _                     ' VTable offset = 48
                   BYVAL seltype AS WORD _                     ' WORD seltype
                 , BYVAL lpoleobj AS IUnknown _                ' LPOLEOBJECT lpoleobj
                 , BYREF lpchrg AS CHARRANGE _                 ' CHARRANGE FAR * lpchrg
                 , BYREF lphmenu AS DWORD _                    ' HMENU FAR * lphmenu
                 ) AS LONG                                     ' HRESULT
              
                   METHOD = %E_NOTIMPL
              
                 END METHOD
                 ' =====================================================================================
              
              END INTERFACE
              
              END CLASS
              
              ' ========================================================================================
              ' RichCom_EDITSTREAM structure
              ' ========================================================================================
              TYPE RichCom_EDITSTREAM
                 dwCookie    AS DWORD
                 dwError     AS DWORD
                 pfnCallback AS DWORD
              END TYPE
              
              ' ========================================================================================
              ' RichCom_CookieSet structure
              ' ========================================================================================
              TYPE RichCom_CookieSet
                 pszText AS ASCIIZ PTR
                 nLen    AS LONG
                 Currpos AS LONG
              END TYPE
              
              ' ========================================================================================
              ' RichCom_OLEObject structure
              ' ========================================================================================
              TYPE RichCom_OLEObject
                 pIntf    AS DWORD PTR
                 Refcount AS DWORD
              END TYPE
              
              ' ========================================================================================
              ' Insert a formatted RTF string into Rich Edit
              ' ========================================================================================
              FUNCTION RichCom_SetText(BYVAL hWnd AS LONG, BYVAL sText AS STRING, BYVAL bInsertText AS LONG) AS LONG
              
                 LOCAL a           AS LONG
                 LOCAL b           AS LONG
                 LOCAL EDTS        AS RichCom_EDITSTREAM
                 LOCAL RECS        AS RichCom_CookieSet
                 LOCAL bIsVisible  AS LONG
                 LOCAL hOldEvent   AS LONG
                 LOCAL T           AS STRING
              
                  IF hWnd = 0 THEN EXIT FUNCTION
              
                  '// Solve a little problem, when RTF is set, an invisible control is made visible!
                  bIsVisible = IsWindowVisible( hWnd )
              
                  '// Start reading the RTF
                  a = %SF_TEXT
                  IF LEFT$( REMOVE$( UCASE$( LEFT$( sText, 10 ) ), ANY "{ " ), 5 ) = "\RTF1" THEN a = %SF_RTF
              
                  RECS.Currpos        = 0
                  RECS.pszText        = STRPTR( sText )
                  RECS.nLen           = LEN( sText )
              
                  EDTS.dwCookie       = VARPTR( RECS )
                  EDTS.dwError        = 0
                  EDTS.pfnCallback    = CODEPTR( RichCom_EditStreamInCallback )
              
                  IF bInsertText THEN a = a OR &H08000'%SFF_SELECTION
                  SendMessage hWnd, %EM_STREAMIN, a, BYVAL VARPTR( EDTS )
              
                  IF bIsVisible = 0 THEN ShowWindow hWnd, %SW_HIDE
              
                  FUNCTION = EDTS.dwError
              
              END FUNCTION
              ' ========================================================================================
              
              ' ========================================================================================
              FUNCTION RichCom_GetText( BYVAL hWnd AS LONG, BYVAL nMode AS LONG ) AS STRING
              
                  DIM EDTS AS RichCom_EDITSTREAM
                  DIM RECS AS RichCom_CookieSet
                  DIM sRTF AS STRING
                  DIM T    AS STRING
              
                  IF nMode =< 0 THEN nMode = %SF_RTF
              
                  RECS.Currpos        = 0
                  RECS.pszText        = HeapAlloc( GetProcessHeap(), %HEAP_ZERO_MEMORY, 1 )
                  RECS.nLen           = LEN( [email protected] )
                  EDTS.dwCookie       = VARPTR( RECS )
                  EDTS.dwError        = 0
                  EDTS.pfnCallback    = CODEPTR( RichCom_EditStreamOutCallback )
              
                  SendMessage hWnd, %EM_STREAMOUT, nMode, BYVAL VARPTR( EDTS )
              
                  IF RECS.Currpos > 0 THEN FUNCTION = [email protected]
              
                  HeapFree GetProcessHeap(), 0, BYVAL RECS.pszText
              
              END FUNCTION
              ' ========================================================================================
              
              ' ========================================================================================
              FUNCTION RichCom_EditStreamInCallback( dwCookie AS RichCom_CookieSet, BYVAL pbBuff AS BYTE PTR, BYVAL cb AS LONG, pcb AS DWORD ) AS LONG
                  pcb = MIN( dwCookie.nLen - dwCookie.Currpos, cb )
                  IF pcb > 0 THEN
                      MoveMemory BYVAL pbBuff, BYVAL dwCookie.pszText + dwCookie.Currpos, pcb
                      dwCookie.Currpos = dwCookie.Currpos + pcb
                  END IF
              END FUNCTION
              ' ========================================================================================
              
              ' ========================================================================================
              FUNCTION RichCom_LoadFromFile( BYVAL hWnd AS LONG, BYVAL sFileName AS STRING ) AS LONG
              
                  DIM a       AS LONG
                  DIM FF      AS LONG
                  DIM sBuffer AS STRING
              
                  ERRCLEAR
                  a = GETATTR( sFileName )
                  IF ERR OR ISTRUE( a AND %FILE_ATTRIBUTE_DIRECTORY ) THEN EXIT FUNCTION
              
                  FF = FREEFILE
                  OPEN sFileName FOR BINARY SHARED AS #FF
                  sBuffer = STRING$( LOF( FF ), 0 )
                  GET #FF,, sBuffer
                  CLOSE #FF
                  IF sBuffer = "" THEN EXIT FUNCTION
              
                  FUNCTION = RichCom_SetText( hWnd, sBuffer, 0 )
              
              END FUNCTION
              ' ========================================================================================
              
              ' ========================================================================================
              FUNCTION RichCom_SaveToFile( BYVAL hWnd AS LONG, BYVAL sFileName AS STRING, BYVAL nMode AS LONG ) AS LONG
              
                  DIM a       AS LONG
                  DIM FF      AS LONG
                  DIM sRTF    AS STRING
              
                  ERRCLEAR
                  a = GETATTR( sFileName )
                  IF ERR = 0 THEN
                      IF ISTRUE( a AND %FILE_ATTRIBUTE_DIRECTORY ) THEN EXIT FUNCTION
                      KILL sFileName
                      IF ERR THEN EXIT FUNCTION
                  END IF
              
                  sRTF = RichCom_GetText( hWnd, nMode )
              
                  FF = FREEFILE
                  OPEN sFileName FOR BINARY AS #FF
                  PUT #FF, , sRTF
                  CLOSE #FF
              
                  FUNCTION = LEN( sRTF )
              
              END FUNCTION
              ' ========================================================================================
              
              ' ========================================================================================
              FUNCTION RichCom_EditStreamOutCallback( dwCookie AS RichCom_CookieSet, BYVAL pbBuff AS BYTE PTR, BYVAL cb AS LONG, pcb AS DWORD ) AS LONG
              
                  DIM pData AS LONG
              
                  IF cb < 1 THEN EXIT FUNCTION
              
                  '// Create a new piece of memory wich must contain all data collected so far.
                  pData = HeapAlloc( GetProcessHeap(), %HEAP_ZERO_MEMORY, dwCookie.Currpos + cb + 1 )
              
                  '// Copy from earlier retrieved data into new mem.
                  IF dwCookie.Currpos THEN MoveMemory BYVAL pData, BYVAL dwCookie.pszText, dwCookie.Currpos
              
                  '// Free previous mem ASAP.
                  HeapFree GetProcessHeap(), 0, BYVAL dwCookie.pszText
              
                  '// Copy additional piece of data into new mem.
                  MoveMemory BYVAL ( pData + dwCookie.Currpos ), BYVAL pbBuff, cb
                  dwCookie.Currpos = dwCookie.Currpos + cb
              
                  dwCookie.pszText = pData
              
                  pcb = cb
              
              END FUNCTION
              ' ========================================================================================
              Forum: http://www.jose.it-berater.org/smfforum/index.php

              Comment


              • #8
                Strings (ASCIIZ, STRING) are always a 4 byte value (either a pointer or handle), unless you use BYVAL ASCIIZ, which can hit the limit. Personally, I never use BYVAL ASCIIZ and rarely use BYVAL <UDT> as they are somewhat inefficient.
                Kev Peel
                Member
                Last edited by Kev Peel; 6 Sep 2008, 09:56 AM.
                kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

                Comment


                • #9
                  I never use BYVAL ASCIIZ and rarely use BYVAL <UDT> as they are somewhat inefficient.
                  I don't do this myself (I just pass by reference and don't update what shouldn't be updated) but I would think you if you want to pass ASCIIZ / UDT variables to a procedure and be sure you are not accidentally changing them on return, the correct override to use would be "BYCOPY."

                  MCM
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment


                  • #10
                    Yeah its a mixed bag, cause I often see another language call my PB DLL and try to determine if a problem is because I caused it???
                    If you are writing some kind of API for other programmers to use, regardless of language, let me suggest that all string parameters be "AS ASCIIZ" in your code , and if that string is to be filled by your procedure, include a "length of string bufffer" parameter in the procedure header (which you test before filling).

                    This is the way almost all the "winapi" functions are set up so your users should be familiar and comfortable with it.


                    MCM
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment

                    Working...
                    X