Monday, April 13, 2009

Adding ip to pf block list table

pfctl -t [tablename] -T add [ip address]

Wednesday, April 1, 2009

Managed and unmanaged code

Lessons learned from working in the mixed mode c++ (managed and unmanaged code).

"Managed code calls unmanaged code" is a pinvoke (platform invoke) or IJW (it just works)

"Unmanaged code calls managed code" is called a reverse pinvoke. It is restricted to types that exist the same in both code types i.e. basic types and properly ordered structs of basic types.


The term "managed" is used in 2 different aspects:
compilation target (native vs MSIL)
"#pragma managed" and "#pragma unmanaged" are used to define what the code compiles to
by default all code compiled with the /clr option will be MSIL
NON CLS classes can have mixed compilation - some native and some MSIL - but native code can not use managed types directly

platform target (internal to dotNet vs CLS [Common Language Specification])
CLS code is accessible to managed code and must be compiled to MSIL.
This is where rules about no mixing of managed and unmanaged class inheritance apply. Although it should say that CLS class can not inherit from non-CLS classes and non-CLS class can not inherit from a CLS class.