Lol, I am surprised that the library even compiled without the "return addr;".

But, this definition is correct:

shiftMyIP :: MyIP -> MyIP
shiftMyIP ip = unsafePerformIO . alloca $ \ptr -> poke ptr ip >> peek (shiftIP ptr)

The other 2 definitions don't even compile.  And since it works I'll try attaching the files.

You can also get the file here:  http://vragon2.googlepages.com/example.zip

Just run the make file to build.