John Lam 1997 — 2026

User-defined value type marshaling

I got value type marshaling working tonight (but not creation just yet – but that’s fairly straightforward). It wasn’t quite as hard as I thought since I previously thought that value types could be extended. I’ll write more about this issue tomorrow.

Here are the unit tests that now pass:

static Point GetPoint() {
return Point(3, 4);
}
...
class ValueTypeTests < Test::Unit::TestCase
def test_get_point
p = System::MarshalerTests.GetPoint
assert_equal 3, p.X
assert_equal 4, p.Y
assert_equal 'System.Drawing.Point', p.class_name
end
def test_point_instance_method
p = System::MarshalerTests.GetPoint
p.Offset(1, 1)
assert_equal 4, p.X
assert_equal 5, p.Y
end
end
2 archived reader comments

Jared Nuzzolillo (2006/02/10)

Oooo. ooooo! when can we have the new drop?

John Lam (2006/02/10)

I’ve been battling the "fairly straightforward" comment I wrote :) I’ve got most of it figured out now, so I’d expect to see something beginning of next week.