From: SourceForge.net <no...@so...> - 2007-05-21 16:28:56
|
Bugs item #1722331, was opened at 2007-05-20 15:32 Message generated for change (Comment added) made by jimp03 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1722331&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jim Pattee (jimp03) Assigned to: Nobody/Anonymous (nobody) Summary: --add-stdcall-alias and -shared options Initial Comment: * OS version ( Windows XP ) * gcc version ( 3.4.2 ) * ld version ( 2.15.94 ) * mingw-runtime version ( 3.9 ) * w32api version ( 3.6 ) I have a program that loads a dll explicitly using LoadLibrary() and GetProcAddress(). GetProcAddress uses the UNDECORATED function name in the dll call. When the dll is compiled using dllwrap.exe and the option --add-stdcall-alias, the dll is called without a problem. When the dll is compiled using g++ with the -shared option and --add-stdcall-alias, the GetProcAddress fails with "The specified procedure could not be found." When I add the @16 suffix to the function name it is called correctly. It seems like the --add-stdcall-alias doesn't have an effect when g++ is used with the -shared option. Following is a copy of the command line used to call the linker. The file libAStyle.a is not used in linking the calling program. ----------------------------------------------- g++.exe -shared ../objd/ASBeautifier.o ../objd/ASEnhancer.o ../objd/ASFormatter.o ../objd/ASResource.o ../objd/astyle_main.o -L"C:/_jpFiles/Programs/Dev-Cpp/Lib" --add-stdcall-alias --no-export-all-symbols -s -Wl -Wl,--out-implib,../bin/libAStyle.a -o ../bin/AStyle.dll Creating library file: ../bin/libAStyle.a Execution terminated Compilation successful ---------------------------------------------------------------------- >Comment By: Jim Pattee (jimp03) Date: 2007-05-21 10:28 Message: Logged In: YES user_id=826897 Originator: YES I did some more testing and found the following: --add-stdcall-alias works only if there is no space after the comma -Wl,--add-stdcall-alias if there is a space -Wl, --add-stdcall-alias or if it is placed anywhere else in the area it doesn't seem to work. Again, it compiles OK, but it cannot locate the function at run-time. ---------------------------------------------------------------------- Comment By: Jim Pattee (jimp03) Date: 2007-05-21 09:54 Message: Logged In: YES user_id=826897 Originator: YES Thanks, that fixed the problem. But... there was no warning or error when it was sent thru wrong. There was just a run-time error when the function couldn't be located. ---------------------------------------------------------------------- Comment By: Danny Smith (dannysmith) Date: 2007-05-20 16:04 Message: Logged In: YES user_id=11494 Originator: NO --add-stdcall-alias is a linker, not a compiler, option. You should have gotten a warng like: unrecognized command line option "-fadd-stdcall-alias" Try using -Wl,--add-stdcall-alias Danny ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1722331&group_id=2435 |