473,383 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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 2662
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.com> wrote in message
news:11*************@corp.supernews.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.aioe.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.com> wrote in message
news:11*************@corp.supernews.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
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'...
5
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...
4
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,...
6
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
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...
17
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...
4
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)...
2
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...
4
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
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);...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.