![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 68
Rep Power: 3
![]() |
Using a VC++ .lib file from g++
Hi.
If I have a .lib file which I think most likely compiled from Visual Studio, can I link that .lib in a project that uses g++/ld ? I am using mingw32 compiler. I checked the manual -- doesn't seems to indicate any restrictions about this. Is mingw32 a good choice to begin with? I know the contents and functions within that .lib. What I am trying to do is building it in a non-visual-studio environment. Thanks. |
|
|
|
|
|
#2 |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 532
Rep Power: 4
![]() |
Re: Using a VC++ .lib file from g++
c++ libraries created with Microsoft compilers probably can not be used with other compilers because of the non-standard way of mangling symbol names, and non-standard format of libraries. I'd suggest you get the source code of the library and compile it with your g++ compiler.
|
|
|
|
|
|
#3 |
|
Programmer
Join Date: Oct 2007
Posts: 39
Rep Power: 0
![]() |
Re: Using a VC++ .lib file from g++
Ancient Dragon is right. Trying to use an M$ library with g++ is like trying to use a VW transmission in a Ford truck. They don't play well together.
|
|
|
|
|
|
#4 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 754
Rep Power: 3
![]() |
Re: Using a VC++ .lib file from g++
Not directly related, but though I'd mention that this doesn't happen in C, thanks to a lack of name mangling. Unfortunately, if your .lib is already compiled and/or the library code isn't in C, then you'll still have a problem...
__________________
<insert disclaimer here> <insert shameless plug for Visual Studio here> |
|
|
|
|
|
#5 | |
|
Caffeinated Neural Net
![]() Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,007
Rep Power: 5
![]() |
Re: Using a VC++ .lib file from g++
Quote:
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot. - Vaarsuvius, Order of the Stick Last edited by lectricpharaoh; Nov 3rd, 2007 at 12:17 AM. |
|
|
|
|
|
|
#6 |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 532
Rep Power: 4
![]() |
Re: Using a VC++ .lib file from g++
yes I've seen that before two between Microsoft and Borland compilers. Microsoft puts the '_' in front of the symbol name while Borland compilers put it after the name.
|
|
|
|
|
|
#7 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Using a VC++ .lib file from g++
Modification of names in C is more commonly called decoration and involves more than underscores. It provides information about the calling convention (who cleans the stack frame, for one).
C++ (and other languages) uses mangling, since it has to provide copious amounts of information (for overloading and other purposes). Each implementation has to convey more information than a simple description of parameters; for instance, interrupts (some due to error conditions) in one chip family may do entirely different things to the stack frame than interrupts from a different chip family. Layout of structs may be constrained by physical memory implementations. All this can make it very difficult to employ a standardized scheme. Why compilers that deal with the same architecture/hardware use differing schemes is anyone's guess.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#8 |
|
Programmer
Join Date: Oct 2007
Posts: 39
Rep Power: 0
![]() |
Re: Using a VC++ .lib file from g++
|
|
|
|
|
|
#9 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,207
Rep Power: 5
![]() |
Re: Using a VC++ .lib file from g++
That's easy: vendors looking for an edge over competitors. If vendor X can lock a developer into using features that are not supported by (or incompatible with) vendor Y, developers are more likely to stick with vendor X through upgrades, rather than buying a product from vendor Y. Since support of multiple compilers or development environments takes effort, a lot of developers will take the easy path and only use one vendor's compiler.
__________________
Dear God So far today I've done all right. I haven't been grumpy yet. But in a few minutes, God, I'm going to get out of bed, and from then on I'm going to need a lot more help. AMEN |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem processing file into a char array | csrocker101 | C++ | 1 | May 8th, 2007 11:50 PM |
| add mutiple users to the smbpasswd file. | Pizentios | Bash / Shell Scripting | 3 | Oct 20th, 2005 12:48 PM |
| After execution - Error cannot locate /Skin File? | wchar | Visual Basic | 1 | Mar 5th, 2005 9:04 PM |
| airport Log program using 3D linked List : problem reading from file | gemini_shooter | C++ | 0 | Mar 2nd, 2005 4:12 PM |
| Structure char field to a disk file | ehab_aziz2001 | C++ | 0 | Feb 10th, 2005 2:42 PM |