It is. I'm not sure this works anyway (haven't tested it) since the function is not on the heap when you define it as static variable. I thought you'd have to allocate space on the heap, but I could be mistaken here. Anyway, I don't think the memory page you're writing your data into is marked PAGE_EXECUTE_READWRITE. I think you have to call VirtualProtect to change that.
Implementing this one could even write an own inline assembler.