Ver Mensaje Individual
  #16  
Antiguo 05-04-2007
Avatar de vtdeleon
vtdeleon vtdeleon is offline
Miembro
 
Registrado: abr 2004
Ubicación: RD & USA
Posts: 3.236
Reputación: 24
vtdeleon Va por buen camino
Yo tampoco sé, pero según esto:
Cita:
The {$WEAKPACKAGEUNIT} directive is used in rare situations where the units in your package may be referencing DLLs that may not be present on every system. To be precise, this directive was actually created as part of a solution to another problem. Specifically, consider two units, each in a separate package, and both units reference the same DLL. If an application uses both of these units, then two copies of the DLL will be loaded into memory, which causes all kinds of problems with initialization and global variables. The solution to this problem is to put the interface unit of the DLL into a common package.

However, what happens if the DLL is not present on the system? The common package cannot be loaded because it is statically linked to the DLL through the interface unit. This is where the $WEAKPACKAGEUNIT directive comes in. Specifically, this directive affects the way a DCU file is stored in a package's DCP and BPL files. If {$WEAKPACKAGEUNIT ON} appears in a unit file, the compiler omits the unit from the BPL file whenever possible, and creates a non-packaged copy of the unit and places it in the package's DCP file. The non-packaged unit will then be statically linked into applications or other packages when needed.

For example, suppose we have a package called Package1 that contains only one unit, Unit1. Now further suppose that Unit1 does not use any further units, but it makes calls to Rare.dll. If the {$WEAKPACKAGEUNIT ON} directive is inserted in Unit1.pas before compiling, Unit1 will not be included in Package1.bpl. As a result, the Rare.dll will not have to be distributed with Package1. However, Unit1 will still be included in Package1.dcp. If Unit1 is referenced by another package or application that uses Package1, Unit1 will be copied from Package1.dcp and compiled directly into the project.
Enlace
__________________
Van Troi De León
(Not) Guía, Code vB:=Delphi-SQL, ¿Cómo?
Viajar en el tiempo no es teóricamente posible, pues si lo fuera, ya estarían aqui contándonos al respecto!
Responder Con Cita