简体   繁体   English

是否可以使用Turbo C / C ++编译器生成DLL?

[英]Is it possible to generate a DLL using Turbo C/C++ compiler?

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". 我需要从Java类(JNI)调用C函数,并且我知道可以使用“ Microsoft Visual C ++编译器”来执行此操作。 ( explained here ) 在这里说明

But I am interested to know if something similar can be done using TC or TCC . 但是我很想知道是否可以使用TCTCC进行类似的操作。

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" 我没有“ Microsoft Visual C ++”的副本,并且不确定cl.exe是否可用,而无需安装“ Microsoft Visual Studio”

Short answer: TC is perfectly capable to create a DLL. 简短的答案: TC非常有能力创建DLL。

Long answer: Turbo C++ is very old. 长答案: Turbo C ++ 老。 The JNI include files might be using some language features not supported by TC. JNI包含文件可能正在使用TC不支持的某些语言功能。 You might have better luck using another free compiler , for example Visual C++ 2008 Express . 使用另一个免费的编译器 ,例如Visual C ++ 2008 Express ,可能会更好。

MinGW is a free port of gcc. MinGW是gcc的免费端口。 Great alternative to VS. VS的绝佳替代品。 Here is a tutorial on how to build jni libraries. 是有关如何构建jni库的教程。 TC is too old. TC太旧了。

cl.exe is available without the full Visual Studio IDE. cl.exe在没有完整的Visual Studio IDE的情况下可用。 The 'Express' install for Visual Studio C++ has an option to install only the command line tools (handy for build machines). Visual Studio C ++“ Express”安装具有一个选项,可以仅安装命令行工具(对于构建计算机而言非常方便)。

Of course, you can install the IDE, too. 当然,您也可以安装IDE。 You'll get the command line tools in that installation as well. 您还将在该安装中获得命令行工具。

Finally, the Windows Driver Kit (WDK) comes with a command line compiler. 最后, Windows Driver Kit(WDK)带有命令行编译器。

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). 另外,您链接到的Turbo C / C ++是1991年的-我不确定它是否可以生成DLL,但是几乎可以确定它无法生成Win32 DLL(我想最好的方法是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. 如果使用JNI可以做任何事情,我认为这是一个奇迹。

Yes I agree with DR. 是的,我同意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. 使用一个用于MS的免费工具(Visaul C ++ Express),您会好得多。只需创建一个库项目,编写代码,然后将其编译为DLL。

Cheers 干杯

Yes its possible 是的,有可能

I have written a simple tutorial for implementing a "Hello World" program using "Borland Turbo C++" and JDK 1.5 我编写了一个简单的教程,用于使用“ Borland Turbo C ++”和JDK 1.5实现“ Hello World”程序

Check it out - here 在这里查看

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM