Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Java Calling the miniLab 1008 DLL's

Posted on 2003-03-12
6
Medium Priority
?
593 Views
Last Modified: 2007-12-19
An interface board called the miniLab 1008 is controlled via DLL (MccMinilab.DLL) calls to read or set the values of it's I/O ports.

The documentation says that the DLL's functions can be called by using MS Visual C++, or MS Visual BASIC.

Is there an -easy- way to call these DLL functions through Java? If you wouldn't mind looking at the functions and things in the DLL documentation, and seeing how easy it would be first, before attempting to answer, because if it is too hard, I suppose learning VB or VC++ won't be too hard.

Ta!
0
Comment
Question by:Lab_Rat
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 8119119
You will have to use JNI to load the DLL. Therefore you will have two DLLs, one created by your JNI routines, and the Minlab one. See http://java.sun.com/docs/books/tutorial/native1.1/
0
 
LVL 1

Author Comment

by:Lab_Rat
ID: 8127380
Hiyah, thanks for the URL, I have one major concern!

If you take a look at this list from the site you gave:

Background
Writing native methods for Java programs is a multi-step process.

1 : Begin by writing the Java program. Create a Java class that declares the native method; this class contains the declaration or signature for the native method. It also includes a main method which calls the native method.
2 : Compile the Java class that declares the native method and the main method.
3 : Generate a header file for the native method using javah with the native interface flag -jni. Once you've generated the header file you have the formal signature for your native method.
4 : Write the implementation of the native method in the programming language of your choice, such as C or C++.
5 : Compile the header and implementation files into a shared library file.
6 : Run the Java program.

All is fine until step 4!
Write the implementation of the native method???
I would try, but unfortunatly it is a DLL that is already written (by a company that most certainly give out source code).

My question is slightly changed therefore:

Can an -existing- DLL be called by the JNI?
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 1000 total points
ID: 8127415
>>Can an -existing- DLL be called by the JNI?

Yes. You load the dll in a platform-specific way and then call the methods.
0
 

Expert Comment

by:CleanupPing
ID: 9058743
Lab_Rat:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 35

Expert Comment

by:girionis
ID: 9714410
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to CEHJ

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question