Other J/direct Features

Source: Internet
Author: User
Tags modifier ole versions

by @dll.import the modifier (tag) within the boot command, you can also use the other two attributes of J/direct. The first item is a simplified access to the OLE function, and the second is the ANSI and Unicode version of the API function selection.

By convention, all OLE functions return a value of type HRESULT, which is a structured integer value defined by COM. If you write a program at the COM level and want to return something different from an OLE function, you must pass a special pointer to it-the memory area where the function will populate the data. In Java, however, we have no pointers available; Moreover, this method is not concise. With J/direct, we can use OLE modifiers in the @dll.import boot command to make it easy to call OLE functions. An intrinsic method that is marked as an OLE function is automatically converted to a COM-form function from the Java-form method signature, which determines the return type.

The second feature is the choice of ANSI or Unicode string control methods. Most of the Win32 API functions that control strings provide two versions. For example, suppose we look at the symbols exported by USER32.DLL, then we don't find a messagebox () function, instead we see the MessageBoxA () and MessageBoxW () functions-the ANSI and Unicode versions of the function respectively. If you don't specify which version to call in the @dll.import boot command, the JVM will try to decide for itself. However, this operation takes a long time to execute. Therefore, we generally can use Ansi,unicode or auto modifier hard rules.

For more detailed information about these features, refer to the technical documentation provided by Microsoft.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.