How to compile a .lib file?

From Visual Basic to GNU C, this is the place to talk programming.

Moderators: SecretSquirrel, just brew it!

How to compile a .lib file?

Postposted on Thu Dec 02, 2010 5:42 pm

In order to use librsvg with Visual Studio C++ 2010 Express, I need a .lib file, along with some header files. But I can't find any precompiled librsvg for Windows. Well actually I could:
http://ftp.gnome.org/pub/gnome/binaries ... rsvg/2.22/
but it provides a .a file instead, which I assume is for programs running in a cygwin environment.

So I downloaded the source, librsvg-2.32.1, and unpacked it. Now what do I do to get a .lib file? There's no Visual Studio project, just the usual configure script. Would it give me a .lib?
Mothership: Thuban 1055T@3.7GHz, 12GB DDR3, M5A99X EVO, GTX470+Icy Vision Rev.2@840/3800, Vertex 2E 60GB
Supply ship: Sargas@2.8GHz, 12GB DDR3, M4A88TD-V EVO/USB3
Corsair: Macbook Air Ivy Bridge
Crayon Shin Chan
Minister of Gerbil Affairs
 
Posts: 2252
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia

Re: How to compile a .lib file?

Postposted on Thu Dec 02, 2010 6:06 pm

I think all you should need to do is include the headers in your VS project and the DLL in one of the PATHs used by the VS project (this page might help). It doesn't seem like all the functions in the header files were declared with extern though so that probably needs to be changed.
Zoomastigophora
Gerbil Elite
 
Posts: 621
Joined: Tue Nov 11, 2008 7:10 pm

Re: How to compile a .lib file?

Postposted on Thu Dec 02, 2010 6:35 pm

Have you tried the pre-built Windows DLL from here?
(this space intentionally left blank)
just brew it!
Administrator
Gold subscriber
 
 
Posts: 38099
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: How to compile a .lib file?

Postposted on Thu Dec 09, 2010 3:58 pm

Well that's just the problem: there is no DLL provided.

JBI, your link gives me an archive with librsvg-2.dll.a. I don't know how to use it with VS2010. In fact, I doubt you can use it with anything other than Cygwin. There is a difference, right? Plus VS2010 never associated itself with .a files.
Mothership: Thuban 1055T@3.7GHz, 12GB DDR3, M5A99X EVO, GTX470+Icy Vision Rev.2@840/3800, Vertex 2E 60GB
Supply ship: Sargas@2.8GHz, 12GB DDR3, M4A88TD-V EVO/USB3
Corsair: Macbook Air Ivy Bridge
Crayon Shin Chan
Minister of Gerbil Affairs
 
Posts: 2252
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia

Re: How to compile a .lib file?

Postposted on Thu Dec 09, 2010 4:00 pm

Crayon Shin Chan wrote:Well that's just the problem: there is no DLL provided.

JBI, your link gives me an archive with librsvg-2.dll.a. I don't know how to use it with VS2010. In fact, I doubt you can use it with anything other than Cygwin. There is a difference, right? Plus VS2010 never associated itself with .a files.

From your own link:
http://ftp.gnome.org/pub/gnome/binaries ... _win32.zip
Zoomastigophora
Gerbil Elite
 
Posts: 621
Joined: Tue Nov 11, 2008 7:10 pm

Re: How to compile a .lib file?

Postposted on Thu Dec 09, 2010 4:10 pm

You mean, I don't need a .lib file anyway? I can just use the dll? Wait but that's not right, because the archive you linked doesn't provide headers, therefore they probably didn't mean it to be linked against?
Mothership: Thuban 1055T@3.7GHz, 12GB DDR3, M5A99X EVO, GTX470+Icy Vision Rev.2@840/3800, Vertex 2E 60GB
Supply ship: Sargas@2.8GHz, 12GB DDR3, M4A88TD-V EVO/USB3
Corsair: Macbook Air Ivy Bridge
Crayon Shin Chan
Minister of Gerbil Affairs
 
Posts: 2252
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia

Re: How to compile a .lib file?

Postposted on Thu Dec 09, 2010 4:24 pm

Zoomastigophora wrote:I think all you should need to do is include the headers in your VS project and the DLL in one of the PATHs used by the VS project (this page might help). It doesn't seem like all the functions in the header files were declared with extern though so that probably needs to be changed.

Try this?
Zoomastigophora
Gerbil Elite
 
Posts: 621
Joined: Tue Nov 11, 2008 7:10 pm

Re: How to compile a .lib file?

Postposted on Thu Dec 09, 2010 4:41 pm

Crayon Shin Chan wrote:You mean, I don't need a .lib file anyway? I can just use the dll? Wait but that's not right, because the archive you linked doesn't provide headers, therefore they probably didn't mean it to be linked against?

From what I can tell, you need librsvg-dev_[version]-1_win32.zip to build. The other zip is the runtime "distributable". It is pretty obvious that as a developer you will need the dev zip. Inside you will find the headers and the .a file, which seems to be the library output from the mingw32 compiler. It should be essentially like a .lib file so you can try linking to the .a. Otherwise you may need to build your entire project using the mingw32 tools. I remember linking in a .a file before so as long as those guys did their jobs right, you should be fine.
Image
The Model M is not for the faint of heart. You either like them or hate them.

Gerbils unite! Fold for UnitedGerbilNation, team 2630.
Flying Fox
Gerbil God
 
Posts: 24581
Joined: Mon May 24, 2004 2:19 am

Re: How to compile a .lib file?

Postposted on Thu Dec 09, 2010 4:51 pm

The dev zip just contains some header files and a pre-compiled .a file to link to when building. You get the same effect externing the functions and letting the linker either statically link to the DLL or letting Windows dynamically load it at run-time.

Edit: Actually, I might be wrong. Reading up on it, I've confused myself now. Go with FF's advice.
Zoomastigophora
Gerbil Elite
 
Posts: 621
Joined: Tue Nov 11, 2008 7:10 pm

Re: How to compile a .lib file?

Postposted on Thu Dec 09, 2010 5:15 pm

Zoomastigophora wrote:The dev zip just contains some header files and a pre-compiled .a file to link to when building. You get the same effect externing the functions and letting the linker either statically link to the DLL or letting Windows dynamically load it at run-time.

Edit: Actually, I might be wrong. Reading up on it, I've confused myself now. Go with FF's advice.

Well, the file is indeed named librsvg-2.dll.a. So it gives some confidence that it is meant to link in the few symbols that are required to use the DLL in the other .zip file. It is kind of "statically" link to the DLL I suppose.
Image
The Model M is not for the faint of heart. You either like them or hate them.

Gerbils unite! Fold for UnitedGerbilNation, team 2630.
Flying Fox
Gerbil God
 
Posts: 24581
Joined: Mon May 24, 2004 2:19 am

Re: How to compile a .lib file?

Postposted on Thu Dec 09, 2010 6:05 pm

I managed to include a few header files before it complained about a missing glib-object.h. Which is when it struck me - I don't want the main program to be dependent on GTK 2.20 and libxml2 just to satisfy librsvg when it already depends on an outdated version of Qt 3.3 and a lot of other proprietary stuff with a build environment that only that computer has. So I think I'll spin the function that this part of the program is supposed to fulfill into a separate program, with its own build environment. It'll communicate with the big complicated Qt program with some other file format which I'll dream up myself.

So in the end, I'm not forced to use librsvg in a Visual Studio environment, which is the big plus. Thanks for the input guys!
Mothership: Thuban 1055T@3.7GHz, 12GB DDR3, M5A99X EVO, GTX470+Icy Vision Rev.2@840/3800, Vertex 2E 60GB
Supply ship: Sargas@2.8GHz, 12GB DDR3, M4A88TD-V EVO/USB3
Corsair: Macbook Air Ivy Bridge
Crayon Shin Chan
Minister of Gerbil Affairs
 
Posts: 2252
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia


Return to Developer's Den

Who is online

Users browsing this forum: No registered users and 6 guests