To amswer my own questions and stop wasting yours.

The call to .loc. should have been in UPPER CASE i.e. .LOC.

In the call to ipcgive I should have explicitly defined a field to pass as
the fourth parm. (this is a flags field for which, according to the manual,
none are currently defined)

Anyway that how I got it to compile. Whether it works is another problem.