18.3.1 Choosing Module Attributes

As noted in Chapter 2, there are four fields for the .MODEL directive: memory model, language type, operating system, and stack type. When you write a DLL, you can choose the attributes you would normally use for the first two fields. OS/2 system calls use the Pascal calling convention, so you may find it convenient to make all your modules use this convention as well.

Summary: DLLs use the OS_OS2 and FARSTACK attributes.

The operating system and stack fields should be OS_OS2 and FARSTACK, respectively. You should use the NEARSTACK attribute only if you switch execution to your own stack.

A usable declaration is therefore

.MODEL large, pascal, os_os2, farstack

If you are using full segment definitions, remember to generate an ASSUME directive for DS but not for SS.

ASSUME DS:DGROUP ; Necessary with full segment definitions