Skip to content

Instantly share code, notes, and snippets.

View lucasmeijer's full-sized avatar

Lucas Meijer lucasmeijer

  • Unity Technologies
  • Amsterdam
View GitHub Profile
This file has been truncated, but you can view the full file.
namespace Unity.Entities.UniversalDelegates
{
public delegate void R<T0>(ref T0 t0);
public delegate void I<T0>(in T0 t0);
public delegate void V<T0>(T0 t0);
public delegate void RR<T0, T1>(ref T0 t0, ref T1 t1);
public delegate void RI<T0, T1>(ref T0 t0, in T1 t1);
public delegate void RV<T0, T1>(ref T0 t0, T1 t1);
public delegate void IR<T0, T1>(in T0 t0, ref T1 t1);
public delegate void II<T0, T1>(in T0 t0, in T1 t1);
using Terminal.Gui;
static class Demo {
private static Window _firstWindow;
static void Main ()
{
Application.Init ();
int counter = 0;
/* Visual Studio project generation is quite a topic. Grab a coffee.
A visual studio _project_ always has a "Configuration" string, and a "Platform" string.
You're free to choose whatever configuration string you want, but the platform string has
to be from a finite set of known values. ("Win32","x64","ARM", "ORBIS","CRT"}.
Some visual studio features (I'm not sure exactly which, but at minimum debugging, and some console things),
require that the platform value is set correctly. You cannnot debug an orbis executable without having its
platform set to ORBIS. Platforms that don't have any fancy VS features (like emscripten) are free to just set Platform to x64.

I'm writing an API method, with two arguments, both of which want to accept "one or more paths". A path in my case is an NPath reference, and I want to be able to call my method both like this:

var mypath1 = new NPath("mydir/myfile.txt");
var mypath2 = new Npath("file2");
myMethod(mypath, mypath2);

as well as with an IEnumerable

IEnumerable<NPath> paths1 = fromsomewhere();

IEnumerable paths2 = fromsomewhereelse();

//Problem: have a XCodeCompilerSettings class and CppCompilerSettings base class, that both provide a .With() method to
//create a copy and change a setting. C# wizards of the internet, surely this can be done more elegantly!
using System;
public class CompilerSettings
{
internal object MemberWiseClone() => base.MemberwiseClone();
internal static T CloneAndModify<T>(T _this, Action<T> callback) where T : CppCompilerSettings
struct A
{
static void Foo();
};
void func()
{
A a;
a.Foo();
//Who can get any microsoft vc++ compiler to emit any warning for any of the horrific code below?
//apparently not me!
//
//Bye, Lucas (@lucasmeijer)
bool boolA, boolB, boolC;
enum MyEnum { kOne, kTwo };
MyEnum myenum;

Hi,

We have a feature that if you do:

m_MyGUiLayer = GetComponent<GUILayer>();

if it turns out there was no GUILayer component, if you later use m_MyGUILayer, instead of getting a NullReferenceException (what you might expect as a c# dev), you get:

@lucasmeijer
lucasmeijer / gist:9de952d508cd9b737518
Last active April 6, 2016 14:27
What is up and down in CoreFX, CoreCLR world.
I've been trying to understand how all moving parts of CoreFX, CoreCLR & ReferenceSource, especially related to
mscorlib. These are my notes / conclusions. If you have more information, or see something that is wrong, please
let me know!
the CoreCLR repo, has an embedded mscorlib inside of it. When diffing this against the referencesource mscorlib,
it looks like it forked at some point, and has received some minor cleanups. most occuring changes:
- change license header
- remove [ResourceExposure] and [ResourceConsumption] attributes.
- some modest improvements. (files like Task.cs, Thread.cs, AppDomain.cs, are files with relatively high amount of changes)
- cleanup. if referencesource code had #if DOTNETCORE, that define has been removed in the coreclr one, as it is now always true.
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace Unity.Il2CPP.Builders
{
public class SimpleExecutable : BuiltProgram
{
private readonly string _path;