LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   add dll file to eclipse c++ (http://www.linuxquestions.org/questions/programming-9/add-dll-file-to-eclipse-c-713413/)

basbosa87 03-21-2009 02:23 PM

add dll file to eclipse c++
 
Hello,

I'm working with eclipse c++ under Kubuntu.

I want to know how to import dll file using eclipse c++.

paulsm4 03-21-2009 02:56 PM

Hi -

You add libraries (static "lib*.a" or shared "lib*.so" libraries) in your Eclipse/CDT project settings.

You're aware, of course, that a ".dll" is a Windows specific shared library: you can't use a Windows .dll under Linux any more than you can use a Linux .so under Windows.

Here's a great "howto":
http://whatwouldnickdo.com/wordpress...nux-libraries/

'Hope that helps .. PSM

basbosa87 03-21-2009 03:10 PM

first,I want to thank you for your reply.

second, i want to ask you that if i convert the
dll file to lib using this:
http://www.binary-soft.com/dll2lib/dll2lib.htm

will it work under linux, if so is what code i have to write to
link to this lib and using its functions.

TITiAN 03-21-2009 03:52 PM

O_O 999$ ... that's a lot. I think the chances are not really good for it to work, since Windows and Linux use different APIs. For example, Windows has an own API for making GUIs (and other windows), while Linux uses GTK+,QT4 etc.

If your dll files don't use any API (say, they can only calculate and say "Hello World"), it is possible that a procedure like this might work; I really don't suggest buying a $999 software program, though.

Another idea: You could try to cross-compile Windows applications using said dll files. You'd need wine to run it, though. I'm not really familiar with cross-compiling, but I think it can't be too hard if you have the development files for your dll.

paulsm4 03-21-2009 05:39 PM

Hi -

1. TITiAN is correct on all counts.

2. "DLL to Lib" *won't* work - and it *can't* work - for your purposes.

Here's why:
a) As you probably know, "program libraries" generally come in two flavors: "shared libraries" and "static libraries".

b) With a "static library", everything the .exe program needs is copied into the executable when it's created (at "link time"). With a "shared library", the .exe merely has a bunch of "external references" to things it needs from the shared library. Using shared libraries makes for smaller .exe's, faster load times, and greater flexibility. The tradeoff is you need to make sure the library is available when the .exe needs it, and you also need to make sure you've got the *right* .dll with the *right* versions of external references. Hence the term ".dll Hell".

c) Libraries - and the code they contain - are by definition *different* for every platform. You can't (directly) run Windows code on Linux, or vice versa.

d) The whole purpose of the "Dll to Lib" product is to convert Windows .dll's (shared libraries) to Windows static libraries (it looks like it generates both Windows .lib and .tlb files). For the convenience of having a Windows static .lib (if you want one, and you don't have the luxury of building one from the original source code, I guess).

e) Congratulations. You just saved $1000 ;-)

3. So basically, whatever you want to use the .dll files for - you need to find different libraries - with the same functionality - for your platform.

Sorry .. PSM

basbosa87 03-21-2009 05:45 PM

yes, you are right.

it was MSXML library for parsing xml, i have work with it
under windows very effectively, and I found that I have to
switch to Linux environment, so I will look for another library
to work with it under linux.

paulsm4 03-21-2009 06:50 PM

Hi -

Here are a couple of options you might wish to consider:

http://expat.sourceforge.net/
http://xerces.apache.org/xerces-c/download.cgi
http://www.grinninglizard.com/tinyxml/

http://discuss.joelonsoftware.com/de...el.3.597252.22

Or perhaps you're interested in something higher-level (for example, maybe you're doing "SOAP", or "Web Services"), and you really don't need to mess with the XML directly.

There are lots of alternatives - and please feel free to open a new thread as questions arise!

Your .. PSM


All times are GMT -5. The time now is 09:27 PM.