From: newthinker <new...@12...> - 2008-09-09 20:23:04
|
It really helps, many many thanks to John E. :) Best Regards, newthinker 2008-09-10 Sender: min...@li... Time: 2008-09-09 22:42:36 Recipient: min...@li... Cc: Title: MinGW-users Digest, Vol 28, Issue 8 Send MinGW-users mailing list submissions to min...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/mingw-users or, via email, send a message with subject or body 'help' to min...@li... You can reach the person managing the list at min...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of MinGW-users digest..." Today's Topics: 1. Re: MinGW - dll and exe linking problems - can't linkstdcall function without decoration (Brian Dessent) 2. Re: MinGW - dll and exe linking problems - can't linkstdcall function without decoration (????????? ????????) 3. Re: MinGW - dll and exe linking problems - can't link stdcall (Jay) 4. Re: New Release: mingw-runtime 3.15 (Keith Marshall) 5. Re: MinGW - dll and exe linking problems - can'tlinkstdcall function without decoration (????????? ????????) 6. Re: MinGW - dll and exe linking problems - can't linkstdcall function without decoration (Earnie Boyd) 7. mingw32-make.exe problem (Alan James Caruana) 8. Need help with domain_error() (newthinker) 9. Re: Need help with domain_error() (John E. / TDM) ---------------------------------------------------------------------- Message: 1 Date: Mon, 08 Sep 2008 13:53:48 -0700 From: Brian Dessent <br...@de...> Subject: Re: [Mingw-users] MinGW - dll and exe linking problems - can't linkstdcall function without decoration To: MinGW Users List <min...@li...> Message-ID: <48C...@de...> Content-Type: text/plain; charset=iso-8859-1 ????????? ???????? wrote: > I try many other ways (with --kill-at, without --kill-at, myTestFunction=myTestFunction@0 > in def and so on), but I can get no satisfaction, exe do not linked with my dll. You need to create an import library for the DLL (and then link with that import lib, obv.) that contains the decorated versions as aliases to the undecorated names. You can do this with dlltool -k. Brian ------------------------------ Message: 2 Date: Tue, 9 Sep 2008 01:09:30 +0400 From: ????????? ???????? <am...@ma...> Subject: Re: [Mingw-users] MinGW - dll and exe linking problems - can't linkstdcall function without decoration To: MinGW Users List <min...@li...> Message-ID: <911...@ma...> Content-Type: text/plain; charset=ISO-8859-1 Hello Brian, >> I try many other ways (with --kill-at, without --kill-at, myTestFunction=myTestFunction@0 >> in def and so on), but I can get no satisfaction, exe do not linked with my dll. BD> You need to create an import library for the DLL (and then link with BD> that import lib, obv.) that contains the decorated versions as aliases BD> to the undecorated names. You can do this with dlltool -k. I thought about this, but have not tried yet. I have some questions about this way: 1) In dll names are undecorated (without @X), whence dlltool knows about what X it must put after @? 2) dlltool --help tels -k --kill-at Kill @<n> from exported names. I think dlltool creates import library in with names in the return necessary to me a direction: FunctionInDll@0 -> FunctionInDll, isn't it? ------------------------------ Message: 3 Date: Mon, 8 Sep 2008 21:33:21 +0000 From: Jay <jay...@co...> Subject: Re: [Mingw-users] MinGW - dll and exe linking problems - can't link stdcall To: <min...@li...>, <am...@ma...> Message-ID: <COL...@ph...l> Content-Type: text/plain; charset="iso-8859-1" Use a .def file? And then optionally don't use __declspec(dllexport). And optionally don't use __declspec(dllimport). All you need a plain declaration and implementation: foo.h: void __stdcall Foo(void); foo.c void __stdcall Foo(void) { } and a .def file: foo.def: EXPORTS Foo With Visual C++: cl -LD foo.c or maybe cl -LD foo.c -link -def:foo.def is all it takes. Something very similar ought to work with MinGWin and Cygwin. Maybe you have to use dlltool? __declspec(dllimport) is only needed, at least with Visual C++, on data. CygWin/MinGWin have some way around that. How does it work? I don't know. __declspec(dllimport) on functions is a small optimization. It is not required. __declpec(dllexport) on functions is a way to muck up your headers instead of using a .def file. Though I guess the GNU folks have copied this with "visibility", meanwhile Sun has like .def files, called .map files (not to be confused with Microsoft .map files, which are a sort of readable textual minimal symbol info.) In the absence of __declspec(dllimport), the linker will generate a single instruction function per import that just jumps through a pointer. With __declspec(dllimport), the compiler will change the call to call through said pointer, or even optimize thereof, prefetching the pointer into a registry for example. For function Foo, the pointer is called __imp__Foo. For extern "C" __cdecl functions, or data, you can even declare the existance of the pointer and use it. Much more difficult in the face of C++ mangling or __stdcall/__fastcall. e.g. something like: extern "C" { extern const FILE* (*__imp__fopen)(const char*, const char*); } #define fopen (*__imp__fopen) Generally works, but no point really. - Jay > ------------------------------ > > Message: 9 > Date: Tue, 9 Sep 2008 00:20:37 +0400 > From: ????????? ???????? > Subject: [Mingw-users] MinGW - dll and exe linking problems - can't > link stdcall function without decoration > To: mingw-users@ > Message-ID: > Content-Type: text/plain; charset=Windows-1251 > > I want to create dll, which exports stdcall function without > decoration (eg muFunction, not a muFunction@0). > I use command as > mingw32-g++ -shared -Wl,--kill-at -Wl,--enable-stdcall-fixup -otest.dll test.def test.o > > Function declared as follows: > EXTERN_C // extern "C" > MYAPIENTRY // __declspec(dllexport) then compiling dll, or __declspec(dllimport) then compiling exe > ULONG > MYCALLTYPE // __attribute__((stdcall)) (for msvc used __stdcall) > myTestFunction( ); > > Module definition file (test.def): > EXPORTS > myTestFunction > > Okay, I get dll with myTestFunction entry, not a myTestFunction@0. > > I try to create exe, which calls my function myTestFunction from dll > mingw32-g++ -Wl,--kill-at -Wl,--enable-stdcall-fixup -otest.exe test.o -ltest > > Now I get next error: > test.o: In function `main': > test.cpp:21: undefined reference to `myTestFunction@0' > collect2: ld returned 1 exit status > > I try > mingw32-g++ -Wl,--kill-at -Wl,--enable-stdcall-fixup -otest.exe test.o -llibtest > or > mingw32-g++ -Wl,--kill-at -Wl,--enable-stdcall-fixup -otest.exe test.o -llibtest.a > or > mingw32-g++ -Wl,--kill-at -Wl,--enable-stdcall-fixup -otest.exe test.o -llibtest.leb > > - I get error 'library -llibtest' not found, and I think, take the -ltest is right way to > link with my dll. > > I try many other ways (with --kill-at, without --kill-at, myTestFunction=myTestFunction@0 > in def and so on), but I can get no satisfaction, exe do not linked with my dll. > > What I do wrong? ------------------------------ Message: 4 Date: Mon, 8 Sep 2008 23:19:13 +0100 From: Keith Marshall <kei...@us...> Subject: Re: [Mingw-users] New Release: mingw-runtime 3.15 To: min...@li... Message-ID: <200...@us...> Content-Type: text/plain; charset="iso-8859-1" On Monday 08 September 2008 06:43:44 Keith Marshall wrote: > ?- Microsoft's convention of printing at least three exponent > digits, for "%e" format, (and for "%g" when appropriate), is > retained as default; support for ... More haste == less speed; this ... > _set_output_format(_TWO_EXPONENT_DIGITS) should have been: _set_output_format(_TWO_DIGIT_EXPONENT) > is included, for users of MSVCR80.DLL (and later). Apologies for any confusion, Keith. ------------------------------ Message: 5 Date: Tue, 09 Sep 2008 13:13:49 +0400 From: ????????? ???????? <am...@ma...> Subject: Re: [Mingw-users] MinGW - dll and exe linking problems - can'tlinkstdcall function without decoration To: MinGW Users List <min...@li...> Message-ID: <E1K...@f2...> Content-Type: text/plain; charset=windows-1251 > > > I try many other ways (with --kill-at, without --kill-at, myTestFunction=myTestFunction@0 > > in def and so on), but I can get no satisfaction, exe do not linked with my dll. > > You need to create an import library for the DLL (and then link with > that import lib, obv.) that contains the decorated versions as aliases > to the undecorated names. You can do this with dlltool -k. I try to create an import library: dlltool -k -d mydll.def --dllname mydll.dll --output-lib libmydll.a mydll.dll does not export symbol 'MyFunction@0', only 'MyFunction', and imort library libmydll.a does not contain MyFunction@0 or _imp__MyFunction@0 too. When I try to link my app a Iget an error: undefined reference to `_imp__MyFunction@0' as earlier. ------------------------------ Message: 6 Date: Tue, 09 Sep 2008 08:25:55 -0400 From: Earnie Boyd <ea...@us...> Subject: Re: [Mingw-users] MinGW - dll and exe linking problems - can't linkstdcall function without decoration To: min...@li... Message-ID: <200...@ma...> Content-Type: text/plain; charset=ISO-8859-1; format="flowed" Quoting ????????? ???????? <am...@ma...>: > Hello Brian, > > >>> I try many other ways (with --kill-at, without --kill-at, >>> myTestFunction=myTestFunction@0 >>> in def and so on), but I can get no satisfaction, exe do not linked >>> with my dll. > > BD> You need to create an import library for the DLL (and then link with > BD> that import lib, obv.) that contains the decorated versions as aliases > BD> to the undecorated names. You can do this with dlltool -k. > FYI, linking directly to the DLL also works. You don't need an import library. Earnie ------------------------------ Message: 7 Date: Tue, 9 Sep 2008 14:44:02 +0200 From: "Alan James Caruana" <ajc...@gm...> Subject: [Mingw-users] mingw32-make.exe problem To: min...@li... Message-ID: <bd7...@ma...> Content-Type: text/plain; charset=ISO-8859-1 Hi, I was using mingw32-make in the windows environment (i.e. no MSYS and no CYGWIN), and it was working fine until I shut down my PC. When I restarted, the machine, mingw32-make would not work, and gives an error after each command it executes. The error it gives is the following: mingw32-make: Interrupt/Exception caught (code = 0xc0000005, addr = 0x41f96e) I tried re-installing the make, but nothing improved. How can I solve this problem ? Cheers Alan Caruana ------------------------------ Message: 8 Date: Tue, 9 Sep 2008 22:31:46 +0800 From: "newthinker" <new...@12...> Subject: [Mingw-users] Need help with domain_error() To: "mingw-users" <min...@li...> Message-ID: <200...@12...> Content-Type: text/plain; charset="gb2312" Hello guys, I am learning C++ with mingwby myself, and the progress is really small and I am still a newbie, so don't laugh at me if the questions sounds silly to you. I just practising the domain_error type a little, but always get answers that wasn't the same with the my textbook. The code is like this: if (hw.size() == 0) throw domain_error("student has done no homework"); But the message has nothing to do with what I meant it to be, always it is just: This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. I don't know what is the problem. Could anyone help with this? 2008-09-09 newthinker ------------------------------ Message: 9 Date: Tue, 09 Sep 2008 08:42:09 -0600 From: "John E. / TDM" <td...@td...> Subject: Re: [Mingw-users] Need help with domain_error() To: MinGW Users List <min...@li...> Message-ID: <48C...@td...> Content-Type: text/plain; charset=GB2312 newthinker wrote: > Hello guys, > I am learning C++ with mingwby myself, and the progress is really > small and I am still a newbie, so don't laugh at me if the questions > sounds silly to you. I just practising the domain_error type a little, > but always get answers that wasn't the same with the my textbook. > The code is like this: > > if (hw.size() == 0) > throw domain_error("student has done no homework"); > > But the message has nothing to do with what I meant it to be, always > it is just: > > This application has requested the Runtime to terminate it in an unusual way. > Please contact the application's support team for more information. > > I don't know what is the problem. > Could anyone help with this? > The message you're seeing is the one that is displayed whenever an exception is thrown and nothing catches it. GCC's default termination mechanism doesn't display the contents of the exception. To see the description of any exception that derives from std::exception (including std::domain_error), you could put a try/catch set in main() and display std::exception::what(). For example: #include <iostream> int main() { try { [stuff that might throw] } catch (std::exception& e) { std::cout << e.what() << std::endl; return 1; } } Cheers, John E. ------------------------------ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ------------------------------ _______________________________________________ MinGW-users mailing list Min...@li... You may change your MinGW Account Options or unsubscribe at: https://lists.sourceforge.net/lists/listinfo/mingw-users End of MinGW-users Digest, Vol 28, Issue 8 ****************************************** __________ Information from ESET NOD32 Antivirus, version of virus signature database 3426 (20080908) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com |