Author Topic: INCLUDE directory ordering: VACPP vs OS2_Toolkit vs GCC  (Read 707 times)

Dariusz Piatkowski

  • Hero Member
  • *****
  • Thank You
  • -Given: 14
  • -Receive: 23
  • Posts: 940
  • Karma: +10/-0
    • View Profile
INCLUDE directory ordering: VACPP vs OS2_Toolkit vs GCC
« on: December 27, 2020, 11:42:33 pm »
I'm wondering if someone can provide references, pointers and/or explanation as to the correct setups when it comes to compiling a standard OS/2 program using the VACPP 3.65 release (3.08 should be fairly similar I think?) and the OS2_Toolkit?

Beyond this core concept, how should the GCC stuff tie into all of the above?

I think of the GCC stuff as replacing the VACPP compiler functionality, and therefore as such would still want to use the OS2_Toolkit includes I believe?

In my current configuration I have all three installed, haven't really done much other than basic compiles with all of them. They all seem to work fine. But once you start building the more complex stuff I'm running into difficulties figuring out which INCLUDE directories to use and specifically what order they should all come in?

Here is a very specific use-case as it applies to the DISKIO work I started:

1) TIME.H header file

a) VACPP install (\code\tools\Ibmcpp\include\TIME.H) shows the following

"11-08-00  1:16a         5,715      0 a---  time.h"

Code: [Select]
/********************************************************************/
/*  <time.h> Header File                                            */
/*  IBM C and C++ Compilers for OS/2, AIX and for Windows NT,       */
/*  Version 3.6                                                     */
/*  Licensed Material - Property of IBM                             */
/*  (C) Copyright IBM Corp. 1991, 1997. All rights reserved         */
/*                                                                  */
/********************************************************************/

b) OS2_Toolkit install (\code\tools\toolkit\h\libc\TIME.H) shows the following:

"1-27-16 11:42a         4,181      0 a---  time.h"

Code: [Select]
/********************************************************************/
/*  <time.h> header file                                            */
/*                                                                  */
/*  (C) Copyright IBM Corp. 1991, 1995.                             */
/*  - Licensed Material - Program-Property of IBM                   */
/*  - All rights reserved                                           */
/*                                                                  */
/********************************************************************/

The OS2_Toolkit stuff is the Netlabs release (Warp 4_52 Toolkit - os2tk45-4_5_2-6_oc00.zip - Sep_2017), I believe the os2tk45-4_5_2-9_oc00.zip is the most recent one that I should install.

My approach to upgrading has been to overlay the original OS2_Toolkit install with the Netlabs updates (all appropriate directory structure having been mapped to the original OS2_Toolkit structure as opposed to dumping the Netlabs stuff into the /usr/include/os2tk45...).

I've attached both versions of TIME.H so you can see the differences.

Lars

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 75
  • Posts: 786
  • Karma: +22/-0
    • View Profile
Re: INCLUDE directory ordering: VACPP vs OS2_Toolkit vs GCC
« Reply #1 on: December 28, 2020, 01:50:11 am »
What I do is to put the Toolkit OS/2 API directory FIRST in the INCLUDE directive (or the individual includes from the compiler command line), THEN the VACPP include directory that contains all includes for the RTL functions and then whatever else I need. About the same holds true for the LIB directive.

In short: you should use the OS/2 API include files instead of the ones supplied with VACPP. In fact, I NEVER install the VACPP toolkit headers / toolkit import libraries. What we have today as RPM is much newer and up-to-date. On the other hand, you should NEVER use the RTL include files from the toolkit (the files in toolkit\h\libc). These includes match the static RTL libraries that also come with the TK but they don't match with what comes with VACPP.

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 13
  • -Receive: 208
  • Posts: 2994
  • Karma: +38/-0
    • View Profile
Re: INCLUDE directory ordering: VACPP vs OS2_Toolkit vs GCC
« Reply #2 on: December 28, 2020, 04:29:27 am »
As Lars states, the toolkit is the most up to date. Note that the RPM is incomplete and missing stuff like the IDL stuff.
As for GCC, it has its own version of the toolkit and generally doesn't need it. As well if you use the stuff in h\libc, there will be conflicts. If needed, one way to do it is to export something like 'CPPFLAGS=-idirafter K:/usr/include/os2tk45' so the compiler looks in the toolkit after the GCC includes.
If you do want to use the toolkit headers (not h\libc) from GCC, the correct way to do it is to define USE_OS2_TOOLKIT_HEADERS and maybe edit @unixroot/include/os2.h, namely line 39, which is "#include <os2emx.h>          /* <-- change this line to use Toolkit headers */".
OpenWatcom is similar, usually the toolkit headers are preferred though its own toolkit is often good enough. It needs its lib directories too, for its runtime and such.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Thank You
  • -Given: 14
  • -Receive: 23
  • Posts: 940
  • Karma: +10/-0
    • View Profile
Re: INCLUDE directory ordering: VACPP vs OS2_Toolkit vs GCC
« Reply #3 on: December 28, 2020, 04:46:08 am »
Lars and Dave,
Thank you guys, clearly I have some work to do to get this stuff all buttoned up. Good to know what to look for though, exactly the sort of advice I needed.

Alright, so here is the follow-up question: when Netlabs releases an udpate, such as the os2tk45-4_5_2-9_oc00.zip drop I mentioned, are these meant to be a cumulative fixes (think along the lines of what our fiixpacks used to be - ahh, good ol' day eh?  ;)), or is each one a one-off change?

I ask b/c after a quick look I see stuff that's missing in os2tk45-4_5_2-9_oc00.zip that's clearly part of the os2tk45-4_5_2-6_oc00.zip release I have already installed. Also Dave you mentioning that some stuff is missing makes me think I should not completely wipe-out the existing Toolkit contents but instead simply overwrite them with the Netlabls updates, yeah?

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 13
  • -Receive: 208
  • Posts: 2994
  • Karma: +38/-0
    • View Profile
Re: INCLUDE directory ordering: VACPP vs OS2_Toolkit vs GCC
« Reply #4 on: December 28, 2020, 06:15:24 am »
Alright, so here is the follow-up question: when Netlabs releases an udpate, such as the os2tk45-4_5_2-9_oc00.zip drop I mentioned, are these meant to be a cumulative fixes (think along the lines of what our fiixpacks used to be - ahh, good ol' day eh?  ;)), or is each one a one-off change?

They should be cumulative but really it is up to the maintainer so without asking, who knows. Might be a changelog somewhere, haven't looked.

Quote
I ask b/c after a quick look I see stuff that's missing in os2tk45-4_5_2-9_oc00.zip that's clearly part of the os2tk45-4_5_2-6_oc00.zip release I have already installed. Also Dave you mentioning that some stuff is missing makes me think I should not completely wipe-out the existing Toolkit contents but instead simply overwrite them with the Netlabls updates, yeah?

I wouldn't overwrite your existing toolkit. What I do is generally use the RPM as installed in @unixroot and keep the full one around for if needed.
Never know exactly what changed and what if an include was removed in the RPM and overwriting the toolkit left something dangling for example. Disk space is cheap.

Lars

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 75
  • Posts: 786
  • Karma: +22/-0
    • View Profile
Re: INCLUDE directory ordering: VACPP vs OS2_Toolkit vs GCC
« Reply #5 on: December 29, 2020, 04:53:59 am »
I do the same. I do have the RPM installed but I also installed the full toolkit into its own directory outside of the /user/lib structure.
I normally only use this later installation.