Re: MFC dll and exe porting to 64-bit



See below...

Note that the absence of any code makes it hard to determine what is going on!

On Wed, 28 Nov 2007 07:25:03 -0800, Tailai Chen <TailaiChen@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:

Hi

I had several MFC Dlls and EXEs (32bit was built in VC6) to be ported to
64-bit. I recompile them using PSDK and VC6 on a 64-bit XP SP2 (amd64)
development machine.

The problem is, when testing, although they all compiled and built fine, my
MFC exe was able to load the dll dynamically and can find the exported
functions, BUT the parameters passed when calling the exported function have
been messed up. The exported function CreateInstance(char*, char*, int,
char*) taking four parameters to create an instance of a dialog, and I got an
"Access violation - code c0000005 (first chance)" when debugging with WinDbg,
which clearly that certain parameters are not right.
****
You did not get an "access violation"; you got "an access violation in <module name here>"
and quite likely "at line <number>" which is the line "<text of line here>" and the
backtrace to your call site is "<backtrace here>". Lacking all this information, what we
can safely say is that you made an error in the conversion to 64-bit, but without this
information and you sample code of the DLL, the call, etc., we could not possibly guess
what has gone wrong.
****

So I went on created a sample MFC dll and exe trying to prove. I got an
unexpected results:

e.g. function included in dll print out the parameter it get, when passing
one int, it prints out 0 no matter what the number is, when passing two ints,
it prints out the first one right following a "2345667" which looks like part
of memory address, when passing three parameters, it prints out the first two
right with "3554345".
****
And in the absence of the code for this, we have NO IDEA what you did!
****

I tried regular dll, it works fine, so only to MFC dll

I know this may turn out to be a basic mistake, I will be appriciate that
someone could at least prove me wrong, then I can get my life going again.
****
Give us enough information to help, and we can try. Give us no information, as this post
has, and we haven't a chance
joe
****

Thanks
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: ... Why my Release exe needs mfc80.dll ?
    ... > to supply the MFC dll with your app to make it portable. ... with exe. ...
    (microsoft.public.vc.language)
  • Project : error PRJ0050: Failed to register output.
    ... Im currently refactoring an MFC application to an MFC DLL. ... What reasons would stop regsvr32 registering the DLL? ... Are there some definate do's/dont's when using a DLL vs an EXE? ...
    (microsoft.public.vc.mfc)
  • Re: DLL Class and Resource
    ... embedded in the dll that can be accessed from the .exe so what I am ... lookingto do is create a kind of hybird resource dll / extension dll. ... Is this an MFC DLL? ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Editors
    ... some strip them on exe files by default. ... "preferred base address" and, yup, relocations are completely ... DLL files, though, aren't loaded into their own address space but are ... EXE's "entry-point", though, is not "special" in that it's just an ...
    (alt.lang.asm)
  • Re: DLL pass vector by value crash
    ... The prototype for testfunc is a by-value copy, so it has to make a copy of the value. ... Are you using static linking for either the .exe (if so, it probably won't work correctly, ... clearly using the shared CRT DLL for the DLL you are constructing. ... no crash occurs in either config. ...
    (microsoft.public.vc.mfc)