These macro's are exported from the (ironscheme clr) library.

Common parameters

type is either:
  • a symbol. Eg: Int32 or System.IO.Stream
  • a list implying a generic type. Eg: (Action Int32)
  • #f (false) meaning the type should try to be inferred

Primary syntax

(clr-namespaces)
Returns all the imported at the lexical scope

(clr-reference reference)
reference can be a symbol for the assembly short name (ie System.Web) or a string containing the fully qualified assembly name.

(clr-using namespace)
namespace is a symbol. Eg System.IO .

(clr-call type method instance arg ...)
method is a symbol for a simple name, eg ToInt32 or a string to resolve specific methods, eg "ToInt32(Object)" .
instance is a reference to the object of type . Can be null ('()) for static methods.
arg ... is the arguments passed to the method.

(clr-cast type expr)
expr is the instance to be cast.

(clr-is type expr)
expr is the instance to be tested.

(clr-new type arg ...)
arg ... is the arguments passed to the constructor.

(clr-new-array type size)
size is the size of the array. Must be an integer.

(clr-event-add! type event instance handler)
event is a symbol for the name of the event. Eg Click .
instance is a reference to the object of type . Can be null ('()) for static events.
handler is a procedure taking the same number of arguments as the event's delegate.

(clr-event-remove! type event instance handler)
event is a symbol for the name of the event. Eg Click .
instance is a reference to the object of type . Can be null ('()) for static events.
handler is a procedure taking the same number of arguments as the event's delegate.

(clr-field-get type field instance)
field is a symbol for the name of the field. Eg m_foo .
instance is a reference to the object of type . Can be null ('()) for static fields.

(clr-field-set! type field instance expr)
field is a symbol for the name of the field. Eg m_foo .
instance is a reference to the object of type . Can be null ('()) for static fields.
expr is the value to set the field.

(pinvoke-call library method arg ...)
arg ... is the arguments passed to the method.

Derived syntax

(clr-indexer-get type instance arg ...)
instance is a reference to the object of type .
arg ... is the arguments passed to the indexer.

(clr-indexer-set! type instance arg ... expr)
instance is a reference to the object of type .
arg ... is the arguments passed to the indexer.
expr is the value to set the indexer.

(clr-prop-get type property instance)
property is the name of the property. Eg Height .
instance is a reference to the object of type . Can be null ('()) for static properties.

(clr-prop-set! type property instance expr)
property is the name of the property. Eg Height .
instance is a reference to the object of type . Can be null ('()) for static properties.
expr is the value to set the property.

(clr-static-call type method arg ...)
method is a symbol for a simple name, eg ToInt32 or a string to resolve specific methods, eg "ToInt32(Object)" .
arg ... is the arguments passed to the method.

(clr-static-event-add! type event handler)
event is a symbol for the name of the event. Eg Click .
handler is a procedure taking the same number of arguments as the event's delegate.

(clr-static-event-remove! type event handler)
event is a symbol for the name of the event. Eg Click .
handler is a procedure taking the same number of arguments as the event's delegate.

(clr-static-field-get type field)
field is a symbol for the name of the field. Eg m_foo .

(clr-static-field-set! type field expr)
field is a symbol for the name of the field. Eg m_foo .
expr is the value to set the field.

(clr-static-prop-get type property)
property is the name of the property. Eg Height .

(clr-static-prop-set! type property expr)
property is the name of the property. Eg Height .
expr is the value to set the property.

Not supported

  • ref or out parameters

Last edited Mar 6, 2013 at 4:32 PM by leppie, version 11