| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | initinstance |
jd>
> as far is a have understood i should create a asm-file
> containing a start-code, which jumps to my 'class-register-
> function' in a c-source. but i keep getting the error
> message 'multiple starting addresses found'. (?)
jd>
That dates from C compilers as old as the hills (i.e. Microsoft C 5.x
and 6.x for OS/2 1.x). For many years you have not had to do that.
It differs in name from C++ compiler to C++ compiler, but in a DLL
there is a C function that is called upon startup and termination of a
DLL. If you don't explicitly supply such a function, then a default one
will be linked in for you.
#if defined(__IBMCPP__)
//
// VisualAge C++ does not initialise the C++ runtime environment
// and construct static-duration objects automatically if you
// supply your own _DLL_InitTerm function, so you must explicitly
// call the initialisation routines yourself. You must declare
// them yourself as well. See the manual for full details.
//
ULONG _System _DLL_InitTerm (HMODULE Module, ULONG terminating)
{
extern "C" int _CRT_init () ;
extern "C" void __ctordtorInit () ;
extern "C" void __ctordtorTerm () ;
extern "C" int _CRT_term () ;
if (!terminating) {
if (_CRT_init () != 0) return FALSE ; // Initialise C++ RTL
__ctordtorInit () ; // Call constructors
} else {
__ctordtorTerm () ; // Call destructors
_CRT_term () ; // Terminate C++ RTL
}
return TRUE ;
}
#elif defined(__EMX__)
//
// EMX C++ does not initialise the C++ runtime environment and
// construct static-duration objects automatically if you supply
// your own _DLL_InitTerm function, so you must explicitly call
// the initialisation routines yourself. You must declare them
// yourself as well. See the manual for full details.
//
// N.B. If you are using -Zcrtdll you must *not* call _CRT_init
// and _CRT_term since they will be handled by the EXE that
// references your DLL. Again, see the manual.
//
extern "C"
ULONG _DLL_InitTerm (HMODULE Module, ULONG terminating)
{
extern "C" int _CRT_init () ;
extern "C" void __ctordtorInit () ;
extern "C" void __ctordtorTerm () ;
extern "C" int _CRT_term () ;
if (!terminating) {
if (_CRT_init () != 0) return FALSE ; // Initialise C++ RTL
__ctordtorInit (); // Call constructors
} else {
__ctordtorTerm (); // Call destructors
_CRT_term (); // Terminate C++ RTL
}
return TRUE ;
}
#elif defined(__HIGHC__)
//
// MetaWare High C++ initialises the C++ runtime environment
// and constructs static-duration objects automatically without
// reference to _DLL_InitTerm, so you do not need to perform any
// explicit initialisation or construction therein.
//
// N.B. _DLL_InitTerm is called *before* the C++ runtime is
// initialised and *after* it is terminated, meaning that you
// should not call any C++ runtime functions or use any C++
// objects from within _DLL_InitTerm.
//
extern "C"
ULONG _DLL_InitTerm (HMODULE Module, ULONG terminating)
{
return TRUE ;
}
#elif defined(__BORLANDC__)
//
// Borland C++ initialises the C++ runtime environment and
// constructs static-duration objects automatically without
// reference to _dllmain, so you do not need to perform any
// explicit initialisation or construction in _dllmain.
//
extern "C"
ULONG _dllmain (ULONG terminating, HMODULE Module)
{
return TRUE ;
}
#elif defined(__WATCOMC__)
//
// Watcom C++ initialises the C++ runtime environment and
// constructs static-duration objects automatically without
// reference to __dll_initialize, so you do not need to perform
// any explicit initialisation or construction therein.
//
// N.B. You must resort to calling DosLoadModule if you wish to
// obtain the module handle of the DLL.
//
extern "C"
int __dll_initialize ()
{
return TRUE ;
}
#endif
> JdeBP <
___
X MegaMail 2.10 #0:
--- Maximus/2 3.00
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)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: 440/4 141/209 270/101 105/103 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™.