From: Paul H. <cfu...@ea...> - 2005-09-13 06:18:41
|
ad...@ne... wrote: > Your .def file should map hello_@0 (or hello@0, which I like better) to > hello_: > > hello_@0 = hello_ Thank you for the reply. Is there not an easier way to handle the problem? After I learn the basics, I want to build a DLL which contains about 80 Fortran astronomy routines. Fixing the .def file as in your example will be quite a hassle. By the way, I should have said in my initial posting that my GCC version is 3.4.2. I have successfully built my Fortran/C++ program as a standalone .exe (that is, the Fortran "hello" object code is linked into the .exe instead of being in a DLL). It works, with either calling convention. If I use stdcall, the linker warns that it's doing the "stdcall fixup", and it takes care of the hello_@0 vs. hello_ mismatch automatically. Why doesn't that happen when linking to a DLL? > I really wondered what your point is to want to use stdcall. Looking around the Web, I've seen that DLLs can be done with either calling convention, so I want to know both ways. Also, some places say stdcall is preferable when the DLL and using program are in different languages. That's my situation. http://www.codeproject.com/dll/dll_calling.asp Elsewhere, I've seen someone say that if you can use either convention, and if there seems to be no strong reason to do a DLL one way or the other, then on Windows it's best to use stdcall because that's the API convention. Is any of that wrong? I'm new to DLLs; I sure don't know. Bottom line is that I have a lot of great scientific stuff in Fortran, and it compiles fine with MinGW, but I'm a C/C++ guy and know little Fortran. Libraries would be ok if these tools were for my use only. But DLLs will make them available to other programmers who don't have Fortran compilers. Whatever calling convention best meets that need is the way I want to go. |