Skip to content

Commit

Permalink
Add option to remove AppDomains APIs with compiler constant (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes authored Sep 28, 2018
1 parent 3c23f49 commit f7a31df
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/CoreLibrary.nfproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<OutputName>mscorlib</OutputName>
<IsCoreAssembly>true</IsCoreAssembly>
<IsMscorlib>true</IsMscorlib>
<DefineConstants>$(DefineConstants);NANOCLR_APPDOMAINS</DefineConstants>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
<DocumentationFile>bin\$(Configuration)\mscorlib.xml</DocumentationFile>
</PropertyGroup>
Expand Down
7 changes: 7 additions & 0 deletions source/System/AppDomain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
// See LICENSE file in the project root for full license information.
//

///////////////////////////////////////////////////
// DEV NOTE: to enable the AppDomain API add //
// 'NANOCLR_APPDOMAINS' to the compile constants //
///////////////////////////////////////////////////
#if (NANOCLR_APPDOMAINS)

using System.Reflection;
using System.Threading;
using System.Runtime.CompilerServices;
Expand Down Expand Up @@ -113,3 +119,4 @@ public Assembly Load(String assemblyString)
public static extern void Unload(AppDomain domain);
}
}
#endif // #if (NANOCLR_APPDOMAINS)
5 changes: 5 additions & 0 deletions source/System/Threading/Thread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,16 @@ public extern ThreadState ThreadState
get;
}

#if (NANOCLR_APPDOMAINS)

/// <summary>
/// Returns the current domain in which the current thread is running.
/// </summary>
/// <returns>An AppDomain representing the current application domain of the running thread.</returns>
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern AppDomain GetDomain();

#endif // #if (NANOCLR_APPDOMAINS)

}
}

0 comments on commit f7a31df

Please sign in to comment.