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 8724879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:55:09+00:00 2026-06-13T07:55:09+00:00

I tried compiling a dll under Cygwin with a ‘.a file’ that was created

  • 0

I tried compiling a dll under Cygwin with a ‘.a file’ that was created via dlltool using foo.def file. In the .def file, I can see that register_callback exists:

EXPORTS
    ...
    register_callback @7569
    ...

The .a file was created using dlltool --def foo.def --output-lib libfoo.a.

However, when linking the main.o file, g++ complains that _register_callback is undefined.
main.o:main.cpp:(.text+0x6e): undefined reference to '_register_callback'

g++ -shared -lfoo -o plugin.dll main.o

nm libfoo.a | grep 'register_callback' shows:

00000000 b .bss$lazy_iregister_callback
00000000 r .rdata$lazy_iregister_callback
00000000 b __imp__register_callback
00000000 T _register_callback
00000000 b .bss$lazy_iunregister_callback
00000000 r .rdata$lazy_iunregister_callback
00000000 b __imp__unregister_callback
00000000 T _unregister_callback

It looks like with or without the -lfoo doesn’t make a difference.

Any pointers towards solving this issue would be appreciated.

  • 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-06-13T07:55:10+00:00Added an answer on June 13, 2026 at 7:55 am
    g++ -shared -lfoo -o plugin.dll main.o
    

    should be

    g++ -shared -o plugin.dll main.o -lfoo
    

    i. e. move the linker flag that specifies a library to the end of the command line invocation. This is required for newer versions of GCC (rather the GNU toolchain) since ld now expects that the files be specified in the same order that the symbols depend on each other.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i tried using cygwin gcc compiler along with netbeans to create dll files it
I have tried compiling the service EXE file as AnyCPU, x86, and x64. It
Recently I tried compiling program something like this with GCC: int f(int i){ if(i<0){
Yesterday I installed clang 3.1 and g++ 4.7 and tried compiling a project I'm
I was trying to speed up some code, and then I tried compiling a
Tried to create a mobile navigation using dataview or outline and the view renders
I have a Delphi 6 application that sends bitmaps to a DirectShow DLL in
While compiling R source 2.15.1 in Windows 7, I get following error. comm: file
I'm trying to create a DLL that will later be used in Inno Setup.
We are producing a DLL that is targeted at both Windows 7 and XP.

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.