#254 Solution task doesn't do COM, OCX apps built in VC++

0.85
closed-fixed
Tasks (408)
5
2004-12-08
2004-12-03
Hani Atassi
No

The solution task for VC++ apps, doesn't call the MIDL
task to compile IDL files.

In this way, you cannot build COM or OCX outputs using
NAnt's solution task.

The output of the MIDL is needed by the resource
compiler when compiling the resource file. Refere to (Bug
ID 1077712) for a fix to the resource problem.

Discussion

  • Hani Atassi

    Hani Atassi - 2004-12-06

    Logged In: YES
    user_id=590187

    Ok... There is actually quite a bit of changes to let the
    solution task compile COM and OCX project:

    1- The solution task doesn't support MIDL, so I had to
    add code to call the MIDL task from the solution task.
    2- If the output is OCX, the function IsOutputDll returns
    false, eventhough the OCX file is acually a DLL file. So,
    it should be changed to return true.
    3- If the COM is built using MFC or DLL, you need to use
    the fix in bug ID 1078636.
    4- Had to add a new function CreateMidlArgumentMap()
    to support mapping arguments of MIDL tool.
    5- Dlldata inside MidlTask is declared as string. If it's a
    file, why it's not of type FileInfo!.
    6- I added a new child for the MidlTask and called it
    Undefines.

    After the previous changes, the solution task worked
    perfectly and I could compile my old OCX projects that I
    built using MFC. The only wierd thing is that, some of
    the regular output messages from the MIDL tool are
    treated as Warnings...

    Attached are the changes...

    Hope this helps..

     
  • Hani Atassi

    Hani Atassi - 2004-12-06

    Includes a sample of the bug and a proposed fix.

     
  • Hani Atassi

    Hani Atassi - 2004-12-07

    Logged In: YES
    user_id=590187

    Found some problems with the function BuildIDLFiles
    that is included with the previous file.

    I added comments on the logic..

     
  • Hani Atassi

    Hani Atassi - 2004-12-07

    Some fixes to the function BuildIDLFiles

     
  • Gert Driesen

    Gert Driesen - 2004-12-08

    Logged In: YES
    user_id=707851

    In your last change, shouldn't this :

    string outputDirectory = fileConfig.GetToolSetting
    (compilerTool, "OutputDirectory");
    if (StringUtils.IsNullOrEmpty(outputDirectory)) {
    outputDirectory = fileConfig.ProjectDir.FullName;
    } else {
    midlTask.Arguments.Add(new Argument("/out"));
    midlTask.Arguments.Add(new Argument
    (outputDirectory));
    }

    be changed into this :

    string outputDirectory = fileConfig.GetToolSetting
    (compilerTool, "OutputDirectory");
    if (StringUtils.IsNullOrEmpty(outputDirectory)) {
    outputDirectory = fileConfig.ProjectDir.FullName;
    }

    midlTask.Arguments.Add(new Argument("/out"));
    midlTask.Arguments.Add(new Argument
    (outputDirectory));
    }

    Well, perhaps its not even necessary specifiy the "/out
    <directory>" argument as "we" always specifiy absolute
    filenames for the individual output files.

     
  • Hani Atassi

    Hani Atassi - 2004-12-08

    Logged In: YES
    user_id=590187

    Yes there shouldn't be an "else" there.

    I just added "/out" to make sure if midl generates any other
    files, they would go to the out folder.

    Also, I did a test with (outfolder) similar to this ($(SolutionDir)
    \Test) and the Type library file ($(IntDir)/
    $(ProjectName).tlb).. From the Visual Studio build i got the
    the tlb file inside the folder:
    $(SolutionDir)\Test\Release\$(ProjectName).tlb

    So, inorder to copy the same behaviour, u need to change
    the code to something like this: (intermediateDir is using the
    outputDirectory instead of the project directory).

    string outputDirectory = fileConfig.GetToolSetting
    (compilerTool, "OutputDirectory");
    if (StringUtils.IsNullOrEmpty(outputDirectory)) {
    outputDirectory = fileConfig.ProjectDir.FullName;
    }

    midlTask.Arguments.Add(new Argument("/out"));
    midlTask.Arguments.Add(new Argument
    (outputDirectory));

    string intermediateDir = Path.Combine
    (outputDirectory,
    fileConfig.IntermediateDir);

     
  • Gert Driesen

    Gert Driesen - 2004-12-08

    Logged In: YES
    user_id=707851

    I committed your patch to cvs.

    Again, thanks for the contributions and the sample app !

     
  • Gert Driesen

    Gert Driesen - 2004-12-08
    • assigned_to: nobody --> drieseng
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks