1

In embarcadero (Borland) C++ compiler we have following pragma Directive:

  • #pragma package(smart_init)
  • #pragma package(smart_init, weak)

as describe in here.

  • What are the pragma directives defined in msvc(Visual C++ compiler) equivalence for above feature?

    For you convenience take a look at here.

Community
  • 1
  • 1
Buddhika Chaturanga
  • 957
  • 2
  • 14
  • 29
  • 2
    "Packages" and "units" are quite specific to Embarcadero and its environments, due to its Delphi relationship. Try to write portable code which doesn't rely on specific initialization order between [translation units](https://en.wikipedia.org/wiki/Translation_unit_(programming)) (which are different from Delphi and Embarcadero "units"). – Some programmer dude Feb 27 '18 at 08:30
  • @Someprogrammerdude thank you. Is this have any relation/quite similar behavior with `init_seg` in msvc? – Buddhika Chaturanga Feb 27 '18 at 08:34
  • Did you try `#pagma init_seg` (https://msdn.microsoft.com/en-us/library/7977wcck.aspx)? – harper Feb 27 '18 at 08:41
  • 3
    The VC++ `init_seg` pragma doesn't seem to have a fixed order of initialization between different libraries, there's no mention of "order of dependency" like the `#pragma package(smart_init)` have. You really should not build your design around specific implementations order of initialization. – Some programmer dude Feb 27 '18 at 08:53
  • @Someprogrammerdude gottcha .. thanks – Buddhika Chaturanga Feb 27 '18 at 09:01

0 Answers0