Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7068249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:18:03+00:00 2026-05-28T05:18:03+00:00

I have developed a C++ DLL-based in-proc COM server and successfully compiled it with

  • 0

I have developed a C++ DLL-based in-proc COM server and successfully compiled it with MinGW + MSYS. If I compile it with --enable-stdcall-fixup -Wl,DLLMain.def switches everything related to COM server works like a charm. However, this way some of the symbols got exported twice:

‘dlltool -z output.def –export-all-symbols libCOMTest.dll’ produces:

EXPORTS
    ...
    DeleteCriticalSection@4 @ 14
    DllCanUnloadNow @ 15 DATA
    DllCanUnloadNow@0 @ 16
    DllGetClassObject @ 17 DATA
    DllGetClassObject@12 @ 18
    DllMain @ 19 DATA
    DllMainCRTStartup@12 @ 20
    DllRegisterServer @ 21 DATA
    DllRegisterServer@0 @ 22
    DllUnregisterServer @ 23 DATA
    DllUnregisterServer@0 @ 24
    EnterCriticalSection@4 @ 25
    ...

And the linker generates a few warnings:

Warning: resolving _DllMain by linking to _DllMain@12
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
Warning: resolving _DllGetClassObject by linking to _DllGetClassObject@12
Warning: resolving _DllCanUnloadNow by linking to _DllCanUnloadNow@0
Warning: resolving _DllRegisterServer by linking to _DllRegisterServer@0
Warning: resolving _DllUnregisterServer by linking to _DllUnregisterServer@0

If I omit these compiler options, the DllMain routine got unexported so I can’t even register my COM server with regsvr32 utility.

Below are some of the exported symbols of libCOMTest.dll :

EXPORTS
    ...
    DeleteCriticalSection@4 @ 14
    DllCanUnloadNow@0 @ 15
    DllGetClassObject@12 @ 16
    DllMainCRTStartup@12 @ 17
    DllRegisterServer@0 @ 18
    DllUnregisterServer@0 @ 19
    EnterCriticalSection@4 @ 20
    ...

As you can see there is no DllMain routine in the list.

My .def file looks as follows:

LIBRARY         libCOMTest
DESCRIPTION     'libCOMTest in-proc server'

EXPORTS
            DllMain         @1  PRIVATE
            DllGetClassObject   @2  PRIVATE
            DllCanUnloadNow     @3  PRIVATE
            DllRegisterServer   @4  PRIVATE
            DllUnregisterServer @5  PRIVATE

What is the reason the DllMain routine got unexported without --enable-stdcall-fixup compile switch? Are there any special tricks for building of in-proc COM server with MinGW + MSYS?

The solution #1

As Hans suggested in his answer, it is possible to use the rename syntax in the .def file as follows:

EXPORTS
    DllGetClassObject   = DllGetClassObject@12
    DllCanUnloadNow     = DllCanUnloadNow@0
    DllRegisterServer   = DllRegisterServer@0
    DllUnregisterServer = DllUnregisterServer@0

The guide to building and using Win32 DLLs in Haskell suggests just the same.

The solution #2

The other way is to make use of the --kill-at linker switch to strip out @nn part:

--kill-at
    If given, the stdcall suffixes (@nn) will be stripped from symbols 
    before they are exported. 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:18:03+00:00Added an answer on May 28, 2026 at 5:18 am

    I don’t know enough about your build tools but can extrapolate. The linker is complaining because you asked to export “DllRegisterServer” but the compiler actually generated the identifier “DllRegisterServer@0” as required for the stdcall calling convention. That’s a mismatch. The –enable-stdcall-fixup option is a workaround for that, putting the linker in ‘fuzzy search mode’ and allowing it to find a match.

    Getting two exports is sloppy but not actually a problem, whatever code uses these entrypoints is always going to ask for the correct one. Definitely try it without –export-all-symbols. The only other thing you could try is to use the rename syntax in the .def file, not sure if your linker supports it:

            DllUnregisterServer=DllUnregisterServer@0  @5  PRIVATE
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a Delphi web server application (TWebModule). It runs as a ISAPI
I have developed a console utility that performs some operations against a server application.
I have developed a Client/Server application for my current employer and one of the
I have developed npruntime based plugin for firefox/chrome and its working fine with ff3.6/chrome
I have developed an WebApplication with Java-Servlets. It is running in a GlassFish-Server (on
I have a site that uses a dll developed with vs2010. In dll i
I have developed some classes with similar behavior, they all implement the same interface.
I have developed some custom DAO-like classes to meet some very specialized requirements for
We have developed our website(Business users website) in .net Framework 2.0 Our client us
I have developed a VB.NET WCF service that recives and sends back data. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.