How to get 64-bit MIDL files to work right?

I have an IDL file that I wrote that builds and runs fine.  Now, we have a requirement to make our server run on 64-bit.  According to the MIDL compiler docs:

"Use the /env win64 switch to generate 64-bit stubs only. The default is to generate dual stubs that run on both platforms."

However, I do not find that to be true.  If I specify /env win64, I get 64-bit stubs.  But, if I don't specify anything, I do not get dual stubs, I get 32-bit stubs that have this:

#if !defined(_M_IA64) && !defined(_M_AMD64)

So, they won't build 64-bit.

Help!


Answer this question

How to get 64-bit MIDL files to work right?

  • awsexton

    Which version of midl.exe and Visual studio are you using

    I found if using 6.00.0347 /Win64 means compling supporting AMD64 and IA64,
    but in 6.0.366.1, /Win64 means compling only supporting AMD64.

    I am afraid there is any special thing changed.


  • yishyuan

    I Have the same problem do U have a solution for that

    Thanks

    Amir



  • Thunder0ne

    Which version of midl.exe and Visual studio are you using

    I found if using 6.00.0347 /Win64 means compling supporting AMD64 and IA64,
    but in 6.0.366.1, /Win64 means compling only supporting IA64.

    I am afraid there is any special thing changed.


  • karlytoz

    We ran "MIDL /app_config xxx.idl" for the 32-bit files and then "MIDL /app_config /x64 xxx.idl" for the 64-bit files. Then we combined them into one xxx.h file, one xxx_c.c file, and one xxx_s.c file.

  • KwanzaBot

    I found out the hard way that you have to specify "/x64" as additional options to the midl compiler to generate 64-bit tlbs. Simply specifying "/env x64" as the MSDN help suggests isn't enough.

    Hope that helps.
    Ahsan

  • Inga Verbitskaya - MSFT

    No, I never did find a solution to this. So, what we did was run the MIDL compiler for 32-bit, then run it again for 64-bit and put it all in one file, separated by #ifdefs...

  • pallavi_020

    Did U run midl xxx.sln

  • How to get 64-bit MIDL files to work right?