|
|
|||||||||||||
IntroductionMicrosoft® J/Direct is a new feature that provides easy access to Microsoft® Windows® dynamic-link libraries (DLLs). Using J/Direct, you can make direct calls to standard Win32 system DLLs (such as KERNEL32 and USER32) and third-party DLLs. J/Direct is far simpler to use than the older Raw Native Interface or the Java Native Interface (known as RNI and JNI, respectively), both of which require you to write a specialized wrapper DLL and perform all non-trivial data type translations yourself. With J/Direct, the vast majority of pre-existing DLL functions can be invoked by simply declaring the function and calling it. J/Direct uses the @dll.import directive, which is similar in usage and in spirit to Visual Basic's DECLARE facility. To use J/Direct, you must install the latest versions of the Microsoft Compiler for Java and the Microsoft virtual machine. These are available with the Microsoft SDK for Java version 3.0 pre-release 2. You can find code samples that use J/Direct under \MsVmJava\Samples\JDirect\ in the directory in which you install the Microsoft SDK for Java. This article explains how to use the @dll.import directive to invoke a DLL function from Java. This article also offers details about how each data type is passed and received, and describes how the @dll.struct directive is used to pass and receive structures from DLL methods. The following topics are included: Specifying @dll.import for an Entire Class How the VM Chooses Between ANSI and Unicode Obtaining the Error Code Set By a DLL Function Dynamically Loading and Invoking DLLs Comparing J/Direct to Raw Native Interface
|
© 1998 Microsoft Corporation. All rights reserved. Terms of use. |