From: Ozkan S. <se...@gm...> - 2009-08-15 05:59:00
|
On Sat, Aug 15, 2009 at 5:14 AM, David Cournapeau<cou...@gm...> wrote: > On Fri, Aug 14, 2009 at 10:20 AM, Ozkan Sezer<se...@gm...> wrote: >> On Fri, Aug 14, 2009 at 7:48 PM, Kai Tietz<kti...@go...> wrote: >>> 2009/8/14 NightStrike <nig...@gm...>: >>>> On Sat, Jun 27, 2009 at 11:41 PM, David Cournapeau<cou...@gm...> wrote: >>>>> Hi, >>>>> >>>>> I am building a plugin (dll) for a software built with VS 2008, which >>>>> linked against the msvcrt90.dll. I am building the plugin with >>>>> mingw-w64, and would like to build it such as it is guaranteed that it >>>>> uses the same CRT as the main program. Is this possible, assuming I >>>>> know the exact version of the msvcrt90.dll ? Up to now, I was building >>>>> the import lib as follows (copied from somewhere, maybe mingw32 >>>>> sources): >>>>> >>>>> PATH=/cygdive/c/Mingw-w64/bin:$PATH >>>>> gcc -DRUNTIME=msvcr90 -D__msvcr90__=1 -D__MSVCRT__ -C -E -P -xc-header >>>>> msvcrt.def.in > msvcr90.def >>>>> dlltool --as=as -k --dllname msvcr90.dll --output-lib libmsvcr90.a >>>>> --def msvcr90.def >>>>> for key in printf fprintf sprintf vprintf vfprintf vsprintf; do >>>>> src=`nm libmsvcr90.a | sed -n -e '/:$/h;/^[0-7][0-7]* *T >>>>> */{s///;H;g;s/\n//p' -e '}' | sed -n 's/:_'"$key"'$//p'`; >>>>> if test -n "$src"; then >>>>> dst=`echo "$src" | sed 's/0/4/'`; repl="$repl $dst"; >>>>> tmpfiles="$tmpfiles $src $dst"; >>>>> ar x libmsvcr90.a $src; >>>>> objcopy --redefine-sym _$key=___msvcrt_$key \ >>>>> --redefine-sym __imp__$key=__imp____msvcrt_$key \ >>>>> $src $dst; >>>>> fi; >>>>> done; >>>>> test `key=_get_output_format; nm libmsvcr90.a | sed -n -e >>>>> '/:$/h;/^[0-7][0-7]* *T */{s///;H;g;s/\n//p' -e '}' | sed -n >>>>> 's/:_'"$key"'$//p'` || repl="$repl ofmt_stub.o"; >>>>> test -n "$repl" && ar rcs libmsvcr90.a $repl; >>>>> rm -f $tmpfiles >>>>> >>>>> But it seems that it does not work, in the sense that passing objects >>>>> across dll boundaries crashes. Is there a better way ? >>>> >>>> Sorry for the delay in answering you. Are you still having difficulties? >>>> >>>> ------------------------------------------------------------------------------ >>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day >>>> trial. Simplify your report design, integration and deployment - and focus on >>>> what you do best, core application coding. Discover what's new with >>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july >>>> _______________________________________________ >>>> Mingw-w64-public mailing list >>>> Min...@li... >>>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public >>>> >>> >>> Yes, sorry for this delayed answer. You can specify at link time of >>> your executable -lmvcr90. Sadly we don't provide at the moment a >>> library for msvcr90,dll. But you can generate the .def file for by >>> using the gendef tool (to be found in our experimental tree >>> /experimental/tools/gendef). If you sent us the generated msvcr90.def >>> file, we will happily add it to our generated libraries. >>> >>> Best regards, >>> Kai >> >> If I understand you correctly, you are already generating msvrt90.def >> and using it to build the necessary *.a file, but your dll file >> crashes when used along with a MSVC-compiled *.exe or dll, is this >> correct? If yes, did you build the mingw-w64 CRT using >> -mms-bitfields flag? > > No, I will try this. I gave up on mingw-w64 because of this problem, > actually. Do I need to build only the runtime with -mms-bitfields, or > the native compilers as well ? > > David > As far as I know, building the runtime with that flag should be enough. We would be very interested to hear your results. -- Ozkan |