Skip to main content

CPP and JNI to print

1 reply [Last post]
albert_kam
Offline
Joined: 2007-11-26
Points: 0

Hi all,

Currently i'm using crEmE in pocket pc to run a Java app. My app needs to communicate with a printer using CPP.

I'm given 3 files, PrinterDriver.exp, PrinterDriver.lib, PrinterDriver.h from the printer provider.

I read from several JNI arcticles, that we need to build a DLL file from microsoft visual C++ (some uses mfc appwizard or something), so that the DLL files could be loaded in Java class.

As i'm not very familiar with CPP, hence the questions :

- Can i use microsoft visual studio 2008 express edition, which includes visual c++, to make the DLL ?

- Could you advise me on setting up the CPP project to use the PrinterDriver.exp, PrinterDriver.lib, PrinterDriver.h thing ? I know .h is to be included, but how about .exp and .lib files ? I have no idea, i tried googling, so far, no luck yet.

- Here's a quote from an email that i received from the printer company.

About JNI - when you compile the java class that contains native methods it shall create header file with function declarations. You must create DLL library project, use the header file and implement all functions from it. DLL must export that functions in "external C" format. Then in implementation of function you can use C++ SDK to deal with printer driver.

I kinda understand his message until i met the bolded area. Can anybody help explaining ? I suspect this is related with the visual c++ IDE, am i right ? :-)

Thank you,
Albert Kam

Message was edited by: albert_kam

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
albert_kam
Offline
Joined: 2007-11-26
Points: 0

I found out this example about building dll using visual c++ and testing out the JNI step by step ..

http://www.rgagnon.com/javadetails/java-0283.html

:-)