473,320 Members | 2,029 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,320 software developers and data experts.

errors while creating a dll using gcc

hi.. i am creating a .dll file from an object file using gcc... i want to create a shared library... i want to use the dll to implement a new functionality.. but when i compile the file for creating the dll i get the following errors..

Cannot export .idata$4: symbol not found
Cannot export .idata$5: symbol not found
Cannot export .idata$6: symbol not found
Cannot export .text: symbol not found
Cannot export ⌂postgres_NULL_THUNK_DATA: symbol not found
collect2: ld returned 1 exit status


i used the following statement to create the dll....



C:\MinGW\bin>gcc -shared -o xpath2.dll xpath2.o -L "C:/Program Files/PostgreSQL
8.3/lib" -lpostgres -lxml2


how can i sort this problem.. please help.. thanks in advance
May 28 '08 #1
5 3709
arnaudk
424 256MB
That is a link-time error (generated by the linker: "ld"), they can be hard to debug. The linker is complaining that some of the symbols referenced in object files or libraries are not present: For example, if your main routine written in main.c calls functions defined in somefile.c, you can compile main.c and somefile.c individually into main.o and somefile.o:

gcc -c main.c -o main.o
gcc -c somefile.c -o somefile.o

Then you link main.o and somefile.o together to make the executable. If you forget to link in somefile.o, you will get this type of error because some symbols in somefile.o referred to in main.o are not present:

gcc main.o somefile.o -o main.exe <-- Good!
gcc main.o -o main.exe <-- linker errors: symbols in somefile.o not found!

It could be caused by any of the libraries you're linking, namely, the postgres and xml2 library. Maybe they're out of date? Or it could be that you're missing some libraries where those symbols are defined. Or it could be that there's some other c/cpp file, that you're forgetting to link in, like in the somefile.c example above.

Also, to catch errors earlier in the compilation process, enable all warnings with:
-Wall -Wpointer-arith -Wstrict-prototypes -Wwrite-strings -Wuninitialized
more info: gcc warning flags.

One last point, if you've declared any of your variables to have external linkage (by prefixing them with 'extern'), ensure that they're actually initialized somewhere.
May 28 '08 #2
Thanks for the reply... the error is with the postgres lib i think.. should i change the library to which i am referrind to or anything else...
May 29 '08 #3
arnaudk
424 256MB
Well, that's hard to comment on, it depends on the specifics of your project. I suggest you comment out as much functionality as possible so that you can compile without errors, then gradually uncomment out more functionality until you isolate the error. Eventually you may be able to track down the error to some functions which you can fix or substitute, etc.
May 29 '08 #4
RRick
463 Expert 256MB
Your problem is not uncommon with creating dlls with gcc. The error message looks to be a generic one where (it appears) gcc doesn't understand the library you are passing.

I have found a couple of links about the problem. but unfortunately, no solution.

http://cygwin.com/ml/cygwin/2004-08/msg01118.html

http://forums.oracle.com/forums/thre...sageID=2171371

http://readlist.com/lists/lists.sour...rs/0/1248.html

If you really need to track down the problem, first try creating a test program instead of the dll. The test program should weed out the various library issues.
May 30 '08 #5
arnaudk
424 256MB
I must say that I've had my fair share of inexplicable problems using MinGW's port of gcc for windows with code that compiled and worked fine with gcc under linux. You'd be better off using a compiler specifically developed for windows. Since you can get VC++ express for free, I don't see why you would want to persevere with a ported *nix compiler.
May 30 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Joonas Paalasmaa | last post by:
Hi, When compiling Sketch's streamfilter C extension the errors below are raised during linking. What could cause the errors? (Python 2.3, MinGw 1.1 with GCC 2.95.3-6, Windows 98) Here are...
10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
12
by: Russ | last post by:
Hello. My new dev machine is running XP Pro. In the past all equipment has only used Windows 2000. I have had a lot of problems getting my projects up and running on the new machine. The current...
0
by: Nathan Kovac | last post by:
I am stumped once again. Perhaps Nicholas or someone will be able to help me solve this issue. For background you can see my earlier post about timers and windows servcice. That issue was...
0
by: Krishnan | last post by:
Hi I am trying to build a small client-server program using OpenSSL functions. I get errors on trying to build the program using Visual Studio .Net (Visual C++ 7.0). I am new to Visual Studio...
7
by: Jeffrey Melloy | last post by:
I have a couple users trying to install Postgres on OS X. To the best of my knowledge, both of them are using 7.4.5/10.3.5, and got identical errors while trying to init the database: Reducing...
2
by: donkeyboy | last post by:
All, I've tried the jythonc compiler to try and create an applet to see how it works, but I get a number of Java compile errors that are way above my knowledge. Does anyone know what any of the...
7
by: brett.estabrook | last post by:
I have written a multi-threaded c# windows service in .net 1.1 (Visual Studio .net 2003). The service has several threads that poll a Sql 6.5 database on another machine. Each thread will execute a...
4
by: Dan | last post by:
Hi All, I've got a problem with my C++ application that calls a Java class that I've built with GCJ, I can't run it because I get errors: multiple definition of `atexit' first defined here...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.