Port of IBM's 1993 WPS "Address Book" sample from SOM 1.0 .SC format to
modern SOM IDL, built with Open Watcom on ArcaOS.
A simple address book containing person objects with names, addresses, and phone numbers. Demonstrates WPS folder subclassing, custom views, the SOM observer pattern, and restrictive containment.
| Class | Inherits from | Purpose |
|---|---|---|
ShrAddressBook |
ShrFolder ??? WPFolder |
Address book with a custom alphabetically-tabbed "Indexed View" |
ShrPerson |
WPAbstract |
Person record with an "Info" settings page |
ShrFolder |
WPFolder |
Intermediate folder with content-add/remove hooks |
ShrList |
SOMObject |
Ordered list (utility) |
ShrNotifier |
SOMObject |
Observer-pattern notification (keeps views synced with models) |
All five classes live in a single DLL (share.dll).
idl\ SOM IDL interface definitions (5 classes)
h\ SOM bindings (.ih/.h) + project headers
src\ C implementations, resource scripts, module definitions
doc\ Original IBM documentation (README.TXT, WPS-PGM.TXT)
release\ Build output (DLL, EXE, import libs, map files)
- Open Watcom installed;
WATCOMenvironment variable set. - SOM toolkit headers at
C:\os2tk45\som\include(or overrideSOMINC). - OS/2 toolkit headers at
C:\os2tk45\h(or overrideWPSINC). - SOM compiler
SC.EXEfrom the toolkit (not Watcom's) ??? needed once to generate bindings.genbind.cmdlocates it automatically. - ArcaOS / OS/2 to run the build (wmake, wcc386, wlink, wrc, implib).
Run from the project directory on the OS/2 side:
genbind
This invokes the SOM compiler on all five .idl files and writes the
.ih / .h bindings into h\. You only need to do this once; the
bindings are checked in and rarely change.
mk
This runs wmake and captures all output to release\wmake.log.
Build products in release\:
| File | Description |
|---|---|
share.dll |
All 5 WPS classes |
shrinst.exe |
Installation helper (optional) |
som.lib |
SOM import library (built from C:\OS2\DLL\som.dll) |
pmwp.lib |
PMWP import library (built from ordinal definitions) |
register
Registers ShrAddressBook and ShrPerson with the WPS and creates an
"Address Book" icon on the desktop. Open it and select "Create person".
Note: on some ArcaOS versions SysRegisterObjectClass returns 0 even
on success. If register reports failure but no popuplog errors, the
registration may have actually succeeded ??? the ground truth is whether
SysCreateObject places the icon on the desktop.
- Converted all five classes from SOM 1.0
.SCformat to standard SOM IDL. dllname = "share.dll"in all IDL implementation sections.pmstddlg.hincluded in the C passthru section ofshrfoldr.idl.
- Makefile.wat:
SYSTEM OS2V2_DLL,-bdfor DLL objects,-wcd=1177for toolkit header warnings, wrc with-i=paths. - Import libraries:
som.libbuilt directly fromC:\OS2\DLL\som.dllviaimplib(the toolkit'ssomtk.libsilently drops PMWP-family entries);pmwp.libbuilt fromsrc\pmwp.defwith ordinal imports (PMWP exports by ordinal only). - genbind.cmd: locates SOM
SC.EXEexcluding Watcom's; usessh.exefor stderr capture when available. - mk.cmd: captures full build output to
release\wmake.log.
- Added explicit
SOMInitModuleinsrc\share.c(modernscdoes not generate it) ??? callsShrListNewClass???ShrNotifierNewClass???ShrFolderNewClass???ShrAddressBookNewClass???ShrPersonNewClass. - Replaced IBM C Set/2
_DLL_InitTerm/_CRT_initpattern with lazy initialization viaShrEnsureDllInit()(Open Watcom has no_CRT_init). - Added diagnostic
ShrLog()calls inSOMInitModulefor bring-up. #pragma linkage(..., system)for all SOM method overrides.
wrcinvoked with-i=$(HDIR) -i=$(SOMINC) -i=$(WPSINC)soshare.h(which includes<som.h>) resolves correctly.
- Check
C:\POPUPLOG.OS2for crash entries mentioningshare.dll. - Check
release\wmake.logfor build errors. - If the DLL was never loaded (no popuplog entry), the import table may
reference DLLs not on
LIBPATH??? verify withlx_export.pyorlx_exp.pyon the built DLL.
The class registered but the WPS could not instantiate it. Common causes:
- Missing parent class (pmwp.dll not loaded).
SOMInitModuledid not run (checkC:\sominit.log).- Instance data size mismatch between IDL and C implementation.
- Unresolved symbols: ensure
genbindwas run andh\has all.ihand.hfiles for the five classes. - wrc errors on
<som.h>: ensureSOMINCpoints to the SOM include directory. - sc "not found": run
genbindfrom the OS/2 side, not the Windows host.
BSD 3 Clauses see LICENSE.
