View previous topic :: View next topic |
Author |
Message |
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Sun Feb 17, 2019 6:15 pm Post subject: Inconsistencies using USE or specific INCLUDEs |
|
|
There is some difference between using USE MSWIN and INCLUDE'ing the 3 files than make up the module MSWIN.
In the MAIN below, I use the MSWIN reference, while in the subroutine, I specifically INCLUDE the .INS files. The link step shows an unknown symbol (GetUserNameA) but only for the subroutine, not the main.
The INCLUDE'ed files win32api.ins does contain the STDCALL for GETUSERNAME that maps to the API function GetUserNameA.
MAIN
Code: |
! PROGRAM SIMPLE
winapp
PROGRAM MAIN
use mswin
character*(256) user
integer:: i,j,k
i=len(user)-1
if(getusername(user,i))continue
end
|
SUBROUTINE
Code: |
subroutine abcd(user)
include <clearwin.ins>
include <win32api.ins>
include <win32prm.ins>
character*(*) user
integer:: i,j,k
i=len(user)-1
if(getusername(user,i))continue
return
end
|
|
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Fri Feb 22, 2019 9:41 am Post subject: |
|
|
I assume it works OK when you put USE MSWIN in the subroutine too ? _________________ ''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... " |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Fri Feb 22, 2019 2:18 pm Post subject: |
|
|
There is no immediate explanation for this. It is OK for /64.
I suggest that you provide your own interface in the form:
STDCALL GetUserNameA 'GetUserNameA' (STRING,REF):LOGICAL*4
then call GetUserNameA. |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Fri Feb 22, 2019 4:09 pm Post subject: |
|
|
John, yes, it works fine with USE MSWIN for all instances.
I discovered this as I integrated another routine and had left the INCLUDE's in place, versus the USE.
Paul, I've scanned all the routines and no more occurrences. I'll continue to USE MSWIN. I point this out only for its "bugginess". |
|
Back to top |
|
|
|