No announcement yet.

How to get (CDECL) and (AS ANY) UNIT's to compile?

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get (CDECL) and (AS ANY) UNIT's to compile?

    The ONLY reason that I still use OBJ file coding at ALL in my
    PB/DOS work is because I have never been able to successfully
    get CDECL subs/functions nor subs/functions that use AS ANY
    arguments to compile as UNIT's. What is the trick to getting them
    to compile? Or are they only SUPPOSED to be compiled as OBJ files?
    I cannot give specifics at this time, but I can re-look the references
    up if need be, but the IDE Help for the PB/DOS 3.5 compiler seems
    to give "mixed signals" on whether these are supposed to be only
    within OBJ files, or whether they CAN (or SHOULD) be able to be
    compiled as UNIT's.

    If they are, or should be, able to compile as UNIT's, will some kind
    soul please provide the information on how they need to be set up?
    (i.e., how to format the DECLARE's, and how to format the subs'/functions'

    MANY thanks for any assistance received.


  • #2
    OK, figured out how to correctly format the DECLARE and prototype
    for a UNIT CDECL procedure (only tested with a $LINKed PBU - have not
    yet tested when the PBU is contained within a library - that's the
    next step).

    If anybody wants to jump in and give me a quick-and-easy answer on how
    to compile a UNIT whose DECLARE uses AS ANY arguments, please
    feel free.



    • #3
      If you mean AS ANY in the procedure header...
      AFAIK, that was never possible in any version of PowerBASIC, DOS or Windows.

      AS ANY is only valid in DECLAREs, and (for sure in Windows, and I think true for MS-DOS) any DECLARE using AS ANY must refer to a function in a separately-compiled code module.

      I "think" PBU (unit) files contain a parameter list in the PBU header which might prevent this.

      And, there is explicit documentation which says you may $LINK and OBJ file only in an EXE:
      The $LINK metastatement is used to link an object module (.OBJ file) a
      unit (.PBU file), or a library (.PBL file) into your main program. It may
      only appear in your main program, never in a unit. Each $LINK
      metastatement may include only one file name, with optional path.
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]


      • #4
        Just a note...

        It might help if you posted any DECLARE statements, the procedure header, and the error message when you encounter these types of problems.


        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]


        • #5
          Thanks for your reply, Michael. Through the test coding I have just
          done, I have come to the conclusion that it is MUCH easier to keep
          my CDECL and AS ANY subs/functions within OBJ modules. I had already
          figured what you said about AS ANY procedures, but wanted to make SURE
          that what I thought was accurate. Moot point, now, since I have decided
          to keep using OBJ files for those kinds of procedures, and for
          CDECL procedures.