La función dll devuelve 1

Im using Java (JNA) to use a function in a third party .dll file. The functions I'm calling are returing the integer value 1.

After reading, I've discovered that this return value is traditionally 0 if everything runs correctly.

Was wondering if this is always the case or if theres any way to determine what it should be?

In the .h file bundled with the .dll it has the comment


After the function.

preguntado el 01 de febrero de 12 a las 14:02

2 Respuestas

Check actual dll documentation, there should be the way to tell what's wrong. If nothing helps try calling GetLastError() WinAPI - some meaningful error code might be reported. Also try to look at debug output during function call - some traces might be there even in Release build

Respondido 01 Feb 12, 18:02

Yes, zero typically means success in the C/C++ world.

In the days before exception handling you had to have a way to indicate failure and the return value was pretty much reserved for failure/success. As for what '1' means, you will have to look in the header of the dll for the function that is returning '1' and see if they included anything about error conditions. There are too many possibilities without seeing the code or knowing more about the dll to provide any easy answers.

What is the name of the function? What is it attempting to do? What can you do if you know the function failed?

Respondido el 14 de diciembre de 13 a las 02:12

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.