Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29541 토론

API Call fails to return anything (however works on another computer)

laddikey
초급자
2,031 조회수
I have a dll that contains the following code:
use dfwin

Character(256) path,path1
integer(4) pathln
pathln = GetModuleFileName (NULL, path1, pathln)

I am using Intel Fortran 9.0

On one computer, the call is fine. We find the path & pathlength. On 2 other development machines we get nothing. I am told that originally the path was indeed returned.

Does anyone have any ideas of what I should/could look for that would cause the API to return nothing. Note: it does not give any sort of errors and such, it simply returns and empty string & a 0 for the length.

Having asked the all important question "What changedd?" did not help. Also of note, I replaced the non functioning code with the funtioning (project files and all, literally everything that is contained in the parent folder) and still the API doesn't return an answer.

HELP!
0 포인트
7 응답
Steven_L_Intel1
2,031 조회수
What does a subsequent GetLastError call return?
0 포인트
Les_Neilson
소중한 기여자 II
2,031 조회수

What is the value of pathln passed into GetModuleFileName?

Les

0 포인트
Jugoslav_Dujic
소중한 기여자 II
2,031 조회수
... that argument should be simply LEN(path1)
0 포인트
laddikey
초급자
2,031 조회수
GetLastError returns a 6.

Although I have decared pathln, I have not set it's value at the time the call is made.
0 포인트
laddikey
초급자
2,033 조회수
ahh, theres the rub JugoslavDujic, I actually am more interested in the path itself (hence the API call). I am indeed using the value of the length but it is the path that I am in search of.

Thanks
0 포인트
Steven_L_Intel1
2,033 조회수
Jugoslav is correct - the third argument is an input that is the size of the path buffer argument. It is not an output parameter. Since you're passing an uninitialized variable, the API routine may or may not decide that the buffer overflows.

If you want the length of the returned path you look at the function result.

Message Edited by Steve_Lionel on 04-18-2006 12:58 PM

0 포인트
laddikey
초급자
2,033 조회수
Beautiful -- thanks Jugoslav & Steve, I misunderstood what you meant but you are correct, as soon as I changed that 3rd argument, it works.

I appreciate the help.
:)
0 포인트
응답