May 2004
Intermediate to advanced
888 pages
22h 31m
English
One of the more powerful features of assemblies is that they can be loaded not just statically as a reference from another assembly but also dynamically at runtime. This is accomplished by using .NET reflection to load the file from disk, find and create objects, and invoke methods. Listing 6.8 shows how this is done.
1: program DynAsm; 2: 3: {$APPTYPE CONSOLE} 4: 5: {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'} 6: 7: uses 8: System.Reflection; 9: 10: var 11: a: Assembly; 12: typ: System.Type; 13: meth: MethodInfo; 14: o: System.Object; 15: begin 16: // load the assembly based on the file name 17: a := Assembly.LoadFrom('D8DG.TestPkg.dll'); ... |
Read now
Unlock full access