Yes, I think your code will work.
Try to give a look at your compilation of the dll.

Regards.