Last active
August 29, 2015 13:58
-
-
Save EifelMono/10017417 to your computer and use it in GitHub Desktop.
Call Delphi initialization section
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure FindInitializationAndCall; | |
var | |
nameSpace: string; | |
foundName: string; | |
helperType: System.Type; | |
begin | |
for helperType in Assembly.GetExecutingAssembly.GetTypes do | |
begin | |
nameSpace:= helperType.Namespace; | |
if Assigned(nameSpace) then | |
begin | |
if not nameSpace.Contains('Borland') then | |
if nameSpace.EndsWith('.Units') then | |
begin | |
foundName:= Copy(nameSpace, 1, Length(nameSpace)- Length('.Units')); | |
if helperType.Name= foundName then | |
if helperType.IsClass then | |
helperType.GetMethod(foundName).Invoke(nil, nil); | |
end; | |
end; | |
end; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment