473,748 Members | 2,471 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 2676
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
2889
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
6767
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
1356
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
3925
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
7008
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
3014
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
6660
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
8060
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
4867
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
8984
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
9530
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
9363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9238
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
6793
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
6073
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
4593
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.