Highlighted
Absent Member.
Absent Member.
2754 views

call-convention 74 is cc74

Jump to solution

I have a subprogram that uses the functions
            call-convention 66 is dynamicWINAPI
            call-convention 74 is cc74

but to include it in .NET project has an error

            call cc74 'FindFirstFileA'
                by using reference findFileName
                      by reference WIN32-FIND-DATA
                returning fileSearchHandle

How to solve this problem?

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

RE: call-convention 74 is cc74

Jump to solution
0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: call-convention 74 is cc74

Jump to solution

To which error are you referring?

You may be getting a warning from the compiler stating that the call will be treated as dynamic and that is normal.

When you are calling a Windows API function from a managed .NET program you are using a Platform Invoke (P/Invoke) in order to call a function within a native .dll from a managed code assembly.

If you were using these call-conventions in a native code program they would be handled differently.

call-convention 66 is a dynamic Windows API call that resolves the call at run-time after loading the appropriate Windows library in this case kernel32.dll.

call-convention 74 is a static Windows API call that resolves the call at link time by linking in the appropriate import library in this case kernel32.lib.

Because there is no link step involved in creating a managed code assembly these two call conventions are treated the same, as dynamic.

This means that kernel32.dll needs to be loaded prior to the call being made.

You can do this in two ways:

1. by adding a reference in your project to the appropriate kernel32.dll in either the Windows\system32 folder or Windows\sysWOW64 fol;der if you are creating a 32-bit assembly on a 64-bit system.

2. Loading the library directly in your program

  01 pp procedure-pointer.

    set pp to entry "kernel32.dll"

If you are making other Windows API calls that reside in other Windows libraries you would have to load these in the same manner.

Thanks.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: call-convention 74 is cc74

Jump to solution
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.