views:

406

answers:

5

I need this for calling a C function from Java class (JNI) and I know that there are options to do this using "Microsoft Visual C++ compiler". (explained here)

But I am interested to know if something similar can be done using TC or TCC.

I don't have a copy of "Microsoft Visual C++" and not sure if cl.exe is available without having to install "Microsoft Visual studio"

+3  A: 

Short answer: TC is perfectly capable to create a DLL.

Long answer: Turbo C++ is very old. The JNI include files might be using some language features not supported by TC. You might have better luck using another free compiler, for example Visual C++ 2008 Express.

DR
@DR The "Visual C++ 2008 Express" required .Net Framework 3.5. I have .Net 2.0 installed. Can you post link to an older version of this expess edition which will work with .Net 2.0Also, if its possible with TCC, was just curious to know how. (if you have any idea)
akjain
No - while the Visual C++ Express Editions are free for personal use, you may not distribute them. Microsoft is the copyright owner, and today they only distribute the VS2008 Express Edition, not 2005.
MSalters
A: 

Yes I agree with DR. You will be much better off using one for MS's free tools (Visaul C++ Express) Just create a library project, code away and then compile it down to a DLL.

Cheers

Mike
+1  A: 

cl.exe is available without the full Visual Studio IDE. The 'Express' install for Visual Studio C++ has an option to install only the command line tools (handy for build machines).

Of course, you can install the IDE, too. You'll get the command line tools in that installation as well.

Finally, the Windows Driver Kit (WDK) comes with a command line compiler.

Also, the Turbo C/C++ you linked to is from 1991 - I'm not sure if it can generate DLLs, but it almost certainly can't generate a Win32 DLL (I'd guess that the best if can do is a Win16 DLL). I wouldn't use it for anything except curiosity/nostalgia. I'd consider it a miracle if it could do anything with JNI.

Michael Burr
+2  A: 

MinGW is a free port of gcc. Great alternative to VS. Here is a tutorial on how to build jni libraries. TC is too old.

tulskiy
A: 

Yes its possible

I have written a simple tutorial for implementing a "Hello World" program using "Borland Turbo C++" and JDK 1.5

Check it out - here

akjain