In VC++ 8, does "Disable Language Extensions" mean no __declspec?

I have been using VC++ 8 Express for the last day or so.  Today I noticed the "Disable Language Extensions" in the Project Properties -> Configuration Properites -> C/C++ -> Language page.

What does turing this to Yes mean for creating a dll file   After removing all "__declspec(dllexport)"  declarations, do ALL functions and classes get exported to the lib/dll, just as if you had put that on everything


Answer this question

In VC++ 8, does "Disable Language Extensions" mean no __declspec?

  • Domer

    I don't suppose there is a way to tell the linker to export everything is there

    Edit:  I'm actually working with generated code, and I cannot change the code generator.  The problem is the generator doesn't put the __declspec on everything that I need, and maintaining a a .def file would become a nightmare (the generated code is around 200,000 lines total).  So either option would be close to a nightmare.

  • Patrick8

    This seems to be my best option, given my choices.

    Thanks for the idea,
    Clay

     Brian_Kramer wrote:
    It doesn't look like fun, except possibly if you're a hardcore Unix shell user.

    haha.

  • Gioking

    The only way I know of is to parse the MAP file. 

    You generate the MAP file by selecting Yes for Linker->Debugging->Generate Map File.   You then would need to pick out the right symbols, perhaps by picking out the values under the Lib:Object column for which an object file is not qualified with a module name (meaning it's your own obj file).

    (Internal builds for MFC DLL's used to be done this way.  It would grab everything from the MAP file, and filter out symbols from a hand-coded list.)

    It doesn't look like fun, except possibly if you're a hardcore Unix shell user.

    Brian




  • JustinCase864

    If you have sed.exe or are willing to download it from SourceForge (http://gnuwin32.sourceforge.net/packages/sed.htm), I think the following may be sufficient to get the list of symbols.

    type dlltest.map | findstr .obj | sed s/......// | findstr /v : | sed s/...............// | sed s/" .*"//
    4Cdlltest@@QAEAAV0@ABV0@@Z
    _DllMain@12
    fndlltest@@YAHXZ
    0Cdlltest@@QAE@XZ
    ndlltest@@3HA

    In order, the one-liner:
    1. echos the map file
    2. gets lines containing ".obj"
    3. removes the first few characters containing the unimportant : character
    4. filters out lines containing the important : character that distinguishes your symbols from other symbols
    5. strips characters before the symbol
    6. strips characters after the symbol

    You could then construct the def file from this list.

    Brian

    PS Not an elegant use of sed, but the differing number of columns seems to preclude a more elegant pattern match.


  • Claire O

    No, none of the definitions get exported. 

    DLL exportation is done by the linker, and there are two ways the linker is told to export something:

    1. When you enter the symbol in the project's DEF file.
    2. When a symbol is decorated with __declspec( dllexport ).

    More info on the first method:

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/vccore98/html/_core_export_from_a_dll_using_..def_files.asp.

    If you end up creating a DEF file, the VS2005 linker setting to specify the file is Linker->Input->Module Definition File.

    The second method came sometime after the first method, since maintaining DEF files get pretty tiresome, especially for C++ symbols.

    Brian

  • In VC++ 8, does "Disable Language Extensions" mean no __declspec?