Ive managed to debug it a little, and it doesnt seem to be the cause of my own dll, but the dll MY dll is based on:

http://users.skynet.be/fa321669/VC++ mysqldllerror.JPG