TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: jan danielsson
from: Mario Semo
date: 1995-08-23 11:23:40
subject: initinstance

Hello jan,

On Aug 17 18:20 95, jan danielsson of 2:205/323 wrote:

 jd> how do i make autostartable code in dll:s?

OS/2 calls a function called 

ULONG _System _DLL_InitTerm(ULONG hmod,ULONG ulFlag)

here the C/C++ init code is performed. you have also to initialize the
C/C++ RT and then add your code. 

i don't have Watcom, so i can't tell what exactly to do in watcom. 

here's a minimal sample for CSET++ 2.1:

ULONG _System _DLL_InitTerm(ULONG hmod,ULONG ulFlag)
{
 if (ulFlag==0)
   {
    if (_CRT_init()==-1)
      return 0UL;
    __ctordtorInit();
   }
 else
   {
    __ctordtorTerm();
   }

 return 1UL;
}

 WARPED!, Mario

--- Msgedsq/2 2.2e
* Origin: LC/32 Development Team-Vienna-Austria (2:310/14.11)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 310/14 1 24/999 2/777 105/42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.