2016-02-18 01:17:49 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2016-03-11 03:00:52 +00:00
|
|
|
|
namespace BizHawk.Common
|
2016-02-18 01:17:49 +00:00
|
|
|
|
{
|
2016-03-23 00:17:28 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// interface for a dynamic link library or similar
|
|
|
|
|
/// </summary>
|
2016-02-18 01:17:49 +00:00
|
|
|
|
public interface IImportResolver
|
|
|
|
|
{
|
|
|
|
|
IntPtr Resolve(string entryPoint);
|
|
|
|
|
}
|
2016-02-20 16:30:05 +00:00
|
|
|
|
|
|
|
|
|
public static class ImportResolverExtensions
|
|
|
|
|
{
|
|
|
|
|
public static IntPtr SafeResolve(this IImportResolver dll, string entryPoint)
|
|
|
|
|
{
|
|
|
|
|
var ret = dll.Resolve(entryPoint);
|
|
|
|
|
if (ret == IntPtr.Zero)
|
|
|
|
|
throw new NullReferenceException(string.Format("Couldn't resolve entry point \"{0}\"", entryPoint));
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-02-18 01:17:49 +00:00
|
|
|
|
}
|