| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | writing REXX DLL`s |
DM>
> BTW, is there a user-function that is called on init (and
> term)? I can't seem to find a reference to it... :-/
DM>
static HMODULE handle = 0 ; // Module handle of the DLL
#if defined(__IBMCPP__)
extern "C" int _CRT_init () ;
extern "C" void __ctordtorInit () ;
extern "C" void __ctordtorTerm () ;
extern "C" int _CRT_term () ;
ULONG EXPENTRY _DLL_InitTerm (HMODULE Module, ULONG terminating)
{
if (!terminating) {
if (_CRT_init () == -1) return FALSE ; // Initialise C++ RTL
handle = Module ; // Save DLL module handle
__ctordtorInit () ; // Call constructors
} else {
#if defined(USING_STATIC_RTL)
__ctordtorTerm () ;
_CRT_term () ;
#endif
}
return TRUE ;
}
#elif defined(__HIGHC__)
extern "C" ULONG _DLL_InitTerm (HMODULE Module, ULONG terminating)
{
//
// MetaWare High C++ handles initialising the C++ runtime itself,
// but still does it _after_ the call to _DLL_InitTerm.
//
if (!terminating)
handle = Module ; // Save DLL module handle
return TRUE ;
}
#elif defined(__EMX__)
//
// IBM VisualAge C++ requires these declarations at file scope rather
// than at function scope because of a bug. I don't know whether EMX
// C++ needs the same or not. If not, put them at function scope.
//
extern "C" int _CRT_init () ;
extern "C" void __ctordtorInit () ;
extern "C" void __ctordtorTerm () ;
extern "C" int _CRT_term () ;
ULONG EXPENTRY _DLL_InitTerm (HMODULE Module, ULONG terminating)
{
if (!terminating) {
if (_CRT_init () != 0) return FALSE ; // Initialise C++ RTL
handle = Module ; // Save DLL module handle
__ctordtorInit () ; // Call constructors
} else {
__ctordtorTerm () ;
_CRT_term () ;
}
return TRUE ;
}
#elif defined(__BORLANDC__)
extern "C" ULONG _dllmain ( ULONG terminating, HMODULE Module )
{
if (!terminating)
handle = Module ; // Save DLL module handle
return TRUE ;
}
#elif defined(__WATCOMC__)
extern "C" int __dll_initialize ()
{
//
// Watcom C++ is complete rubbish at DLLs. There is no module handle
// available here, and the C++ RTL isn't DLL-ified either.
//
return TRUE ;
}
#else
# error "You aren't using a recognised compiler !"
#endif
___
X MegaMail 2.10 #0:
--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)SEEN-BY: 50/99 54/99 270/101 620/243 625/110 160 711/401 409 410 413 430 808 SEEN-BY: 711/809 934 955 712/311 407 505 506 517 623 624 704 713/317 800/1 @PATH: 440/4 141/209 270/101 712/624 711/808 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™.