Why not debug it and see where it fails? Make sure your dll is actually being loaded(it could simply be a path issue or a bad dll(you might have not imported/exported the functions).
Find out where the issue is first. It's either in loading the dll, calling the function, or inside the function