Silverfrost Forums

Welcome to our forums

Inconsistencies using USE or specific INCLUDEs

17 Feb 2019 5:15 #23253

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

!    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

    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
22 Feb 2019 1:18 #23273

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.

22 Feb 2019 3:09 #23274

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'.

Please login to reply.