473,856 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GCC Cygwin C++ DLL linking problem

I have a Windows LIB/DLL that I need to link my GCC program with. I have
followed all the instructions I could find: using pexports to create .def
file from the .dll and then using dlltool to create a .a library file from
the .def file. I've dumped the symbols from the .a and noticed each function
is appeded with an underscore (_). Note that a dump of the DLL does not have
underscores prefixed to the function names. Also, the .def doesn't have any
underscores prefixed to the function names. I have been completely unable to
link my program when compiled as C++ getting the "undefined reference to"
error for each function in the DLL, but I am able to compile and link as C
code. Any suggestions? Thanks for any help.
Jul 23 '05 #1
2 2683
Either you have to recompile LIB/DLL with C++ compiler.
or use quote in your code like:
extern "C" {
#include "LIB/DLL.h"
}

"Sam Tiny" <sp**@nospam.co m> wrote in message
news:11******** *****@corp.supe rnews.com...
I have a Windows LIB/DLL that I need to link my GCC program with. I have
followed all the instructions I could find: using pexports to create .def
file from the .dll and then using dlltool to create a .a library file from
the .def file. I've dumped the symbols from the .a and noticed each function is appeded with an underscore (_). Note that a dump of the DLL does not have underscores prefixed to the function names. Also, the .def doesn't have any underscores prefixed to the function names. I have been completely unable to link my program when compiled as C++ getting the "undefined reference to"
error for each function in the DLL, but I am able to compile and link as C
code. Any suggestions? Thanks for any help.

Jul 23 '05 #2
That fixed it! Thanks a lot.

"modemer" <me@privacy.net .invalid> wrote in message
news:d1******** **@domitilla.ai oe.org...
Either you have to recompile LIB/DLL with C++ compiler.
or use quote in your code like:
extern "C" {
#include "LIB/DLL.h"
}

"Sam Tiny" <sp**@nospam.co m> wrote in message
news:11******** *****@corp.supe rnews.com...
I have a Windows LIB/DLL that I need to link my GCC program with. I have
followed all the instructions I could find: using pexports to create .def
file from the .dll and then using dlltool to create a .a library file
from
the .def file. I've dumped the symbols from the .a and noticed each

function
is appeded with an underscore (_). Note that a dump of the DLL does not

have
underscores prefixed to the function names. Also, the .def doesn't have

any
underscores prefixed to the function names. I have been completely unable

to
link my program when compiled as C++ getting the "undefined reference to"
error for each function in the DLL, but I am able to compile and link as
C
code. Any suggestions? Thanks for any help.


Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2896
by: Sameer | last post by:
Hello Groups, I am facing this linking problem while using a c++ function in a C code. I get this error.... gcc -o a.out cpp.o test.o test.o(.text+0x29):test.c: undefined reference to `add' Kindly tell me what is the problem. Regards,
5
6773
by: J | last post by:
Hi everyone, I started embedding python into a 3D graphics App and I came across this linking problem. SO.lib(ScnGlobal.obj) : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs SO.lib(ScnNode.obj) : error LNK2001: unresolved external symbol __imp___Py_RefTotal
4
1362
by: oguz mut | last post by:
hi, I have a linking problem while living in the following configuration: . windows 2000 . cygwin . g++ (GCC) 3.3.1 (cygming special) I work with the following 3 files (trivial.hpp, trivial.cpp, trivialMain.cpp):
6
404
by: DJ.precario | last post by:
Hi everyone, I am having a linking problem, and I'd appreciate any help with this. The code showing the problem: class base { public: virtual void f(int); };
4
3927
by: Kevin Wan | last post by:
Hi, I have encountered a linking problem while using g++ to link our product. There are Fortran, C, C++ code in our product. The error listed below: /usr/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status But no any reasons or suggestions are given, I'm so puzzled!
17
7022
by: Mitas Nikos | last post by:
I am trying to use the library conio2 and though I have managed with a few relatively simple examples when i try to compile a program which conio's function clrscr is not in main() i get an error from the linker. undefined reference to `clrscr' ld returned 1 exit status I include the conio2.h on top of the file where clrscr() fn is. How do I pass the -lconio parameter when I have multiple files?Isn't it:
4
3023
by: Gary Hughes | last post by:
Hi all, sometime I posted a problem in here where I was getting the following error from the linker in VS C++ 2003. Linking... GCClass.obj : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: GCClass; fields: m_blah): (0x04000001). LINK : fatal error LNK1215: metadata operation failed (80131130) :
2
6668
myusernotyours
by: myusernotyours | last post by:
Hi All, Am working on a Java application in which I have to use the JNI to Interface with some native code for both windows and unix. Am using netbeans IDE with the C/C++ pack installed. Am also using Cygwin as my compiler (gcc), this is ostensibly because I hope this compiler will also compile the unix native libraries since I don't have a Linux installation. (I am working on a personal project from the office and can't get linux installed)....
4
8075
by: naveenmurthy | last post by:
Hello All, I have created a .mht file in following format. 1. The .mht file contains following htmls. a. MHTLinkingProblem.html b. Left.html c. Right.html d. Start.html
2
4879
by: nipun sabharwal | last post by:
void main() { int gd=DETECT,gm; initgraph(&gd,&gm,"c:\\tc\\bgi"); setcolor(GREEN); settextstyle(4,0,8); outtextxy(200,50,"TIME"); setcolor(YELLOW); settextstyle(4,0,8); outtextxy(100,190,"SCHEDULER");
0
9904
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9758
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11051
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10378
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7929
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7087
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5956
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4170
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3196
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.