|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
|
|
How to link with third party libraries using gccI do a fair amount of C programming on Unix but almost none on Windows. I know almost nothing about Windows libraries. I'd be happy if I never had to deal with them at all. But I have a need.
I thought Windows shared libraries were indentified by a ".dll" extension. However I have a commercial product installed that has a C programming interface. It's libraries have a ".lib" extension. I am totally lost as to how to link my program to these files. The Cygwin User's Guide contains an extremely brief section on linking against DLL's (section 4.3.2). It shows how to use "nm" to create a ".def" file and then "dlltool" to create a ".a" file. I don't know how this relates to the ".lib" files that I have. The command given in the User's Guide create the ".def" file is as follows: nm foo.dll | grep ' T _' | sed 's/.* T _//' >> foo.def I don't have a ".dll" file but I noticed that my ".lib" files have lines containing the string " T _" . So I ran the above "nm" command using my ".lib" files. The resulting ".def" file won't work with the second step which is: dlltool --def foo.def --dllname foo.dll --output-lib foo.a The error I get from the above command says that the ".def" file has incorrect format. In summary, I'm totally lost. I have no idea what's going on here. Does any of this make sense to you guys.? Can you tell me how to link against a ".lib" file? Thanks! |
|
|
Re: How to link with third party libraries using gcckm4hr wrote:
> I do a fair amount of C programming on Unix but almost none on Windows. I > know almost nothing about Windows libraries. I'd be happy if I never had to > deal with them at all. But I have a need. > > I thought Windows shared libraries were indentified by a ".dll" extension. > However I have a commercial product installed that has a C programming > interface. It's libraries have a ".lib" extension. I am totally lost as to > how to link my program to these files. > > The Cygwin User's Guide contains an extremely brief section on linking > against DLL's (section 4.3.2). It shows how to use "nm" to create a ".def" > file and then "dlltool" to create a ".a" file. I don't know how this relates > to the ".lib" files that I have. > > The command given in the User's Guide create the ".def" file is as follows: > > nm foo.dll | grep ' T _' | sed 's/.* T _//' >> foo.def > > I don't have a ".dll" file but I noticed that my ".lib" files have lines > containing the string " T _" . So I ran the above "nm" command using my > ".lib" files. The resulting ".def" file won't work with the second step > which is: > > dlltool --def foo.def --dllname foo.dll --output-lib foo.a > > The error I get from the above command says that the ".def" file has > incorrect format. > > In summary, I'm totally lost. I have no idea what's going on here. Does any > of this make sense to you guys.? Can you tell me how to link against a > ".lib" file? You should read up on Windows DLLs. Check out the MSDN for more info. Windows has static libraries just like Unix/Linux does. So your '.lib' may be a static lib. You can typically tell if there is only a '.lib' and not a like-named '.dll'. If yoou have both, then the '.lib' is an "import library". That's what Windows uses to resolve all symbols at link time (again, see Windows docs for more detail). You should be able to link against the '.lib' rather directly if you want to build with Cygwin. Rename 'foo.lib' as 'libfoo.a' and link to it with '-lfoo' just like in Unix/Linux. Of course, if the API you're using is C++, you're stuck using the compiler that the vendor compiled the libs/dlls with. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _____________________________________________________________________ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
Re: How to link with third party libraries using gcckm4hr wrote:
> I thought Windows shared libraries were indentified by a ".dll" extension. > However I have a commercial product installed that has a C programming > interface. It's libraries have a ".lib" extension. I am totally lost as to > how to link my program to these files. A .lib file is just an ar archive (.a) file with a different name. You can rename it if you want, but you don't have to. Just give the name of the file on the link command line. It should also work to specify -lfoo to find foo.lib in the search path. You shouldn't have to futz around with converting anything or creating a def file, I don't know why the users guide says any of that (but see below.) Semantically, a .lib can either be an import library or a static library; in either case the file format is the same, but in the former it is an aide for linking against a DLL, in the latter it is just like static linking on POSIX. On Cygwin import libraries are typically named libfoo.dll.a whereas static archives are just named libfoo.a, but this is just a convention. Some import libraries are named libfoo.a too, for example all of w32api. The ld manual explains the search order for all these various extensions when you specify -lxxx: libxxx.dll.a xxx.dll.a libxxx.a xxx.lib cygxxx.dll (*) libxxx.dll xxx.dll Note that the last three entail direct-DLL linking without use of an import library. Make sure you read the whole win32 section of the ld manual for details of the significance of this. What you really have to understand when trying to use these .lib files is not about filenames or file formats or making .def files or any of that. All you really need to determine is: 1) what calling convention (cdecl or stdcall) does the library use and 2) how are the symbol names decorated? Then just make these match with your toolchain. Usually the two are related, but they are really separate concepts. For 1) you have to get your headers right. For 2) you create an import library that contains the necessary aliases, or if your compiler already uses the same decorations as the library, you can just link against the DLL directly without an import lib at all. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
Re: How to link with third party libraries using gccBrian,
It sounds like the solution could range from something as simple as including the ".lib" files on the gcc command line on up to complicated stuff I've never heard of like "decorations", "toolchains", and "calling conventions". I tried the simple suggestion. I copied the ".lib" files to the directory where my program is located. I then entered the following command: gcc myprog.c library1.lib library2.lib -o myprog I got "undefined reference to ..." errors. One for each library function in my program. Next I removed the ".lib" files from the gcc command string as follows: gcc myprog.c -o myprog I got exactly the same errors as I did with the ".lib" files included. Apparently gcc has no idea what the ".lib" files are. Since I have no comprehesion of "decorations", "toolchains", and "calling conventions", or how to find out what that means, I wonder if there's another explanation. I've got a sinking feeling about this. As if I'm going where no man has gone before. Thanks for trying, Brian. I can tell you know what you're talking about. Unfortunately I'm still completely in the dark.
|
|
|
Re: How to link with third party libraries using gcckm4hr wrote:
> Brian, > > It sounds like the solution could range from something as simple as > including the ".lib" files on the gcc command line on up to complicated > stuff I've never heard of like "decorations", "toolchains", and "calling > conventions". > > I tried the simple suggestion. I copied the ".lib" files to the directory > where my program is located. I then entered the following command: > > gcc myprog.c library1.lib library2.lib -o myprog > > I got "undefined reference to ..." errors. One for each library function in > my program. > > Next I removed the ".lib" files from the gcc command string as follows: > > gcc myprog.c -o myprog > > I got exactly the same errors as I did with the ".lib" files included. > Apparently gcc has no idea what the ".lib" files are. No, it means the '.lib' you gave it doesn't have any of the symbols you need. 'nm' it and see if it has any symbols at all and what they look like. Compare that with feedback you get from the link. If the symbols look similar but are different by just "@" and some number suffixes, then you have a calling convention/decoration problem. Time to read up on that stuff. > Since I have no comprehesion of "decorations", "toolchains", and "calling > conventions", or how to find out what that means, I wonder if there's > another explanation. I've got a sinking feeling about this. As if I'm going > where no man has gone before. Not at all. But you need to learn a little bit about the platform you're working with before things will make some sense to you. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _____________________________________________________________________ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
Re: How to link with third party libraries using gccOn Thu, Jun 28, 2007 at 11:22:24AM -0400, Larry Hall (Cygwin) wrote:
> Not at all. But you need to learn a little bit about the platform you're > working with before things will make some sense to you. What is this "learn" thing of which you speak? Why can't this be more like a toaster? I only had to burn myself half a dozen times before I convinced myself that I didn't like toast. Why can't cygwin be more like that? Why does it take so long to find that you really don't want to use cygwin after all? cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
Re: How to link with third party libraries using gcckm4hr wrote:
> I got exactly the same errors as I did with the ".lib" files included. > Apparently gcc has no idea what the ".lib" files are. No, it would have said "unable to find library1.lib" if that was the case. > Since I have no comprehesion of "decorations", "toolchains", and "calling > conventions", or how to find out what that means, I wonder if there's > another explanation. I've got a sinking feeling about this. As if I'm going > where no man has gone before. No, believe me, this is extremely common when trying to use third party vendor .lib files. When using the stdcall calling convention there is unfortunately a lot of variance in what the various toolchains do; I think this is because most of them trace their roots back to the days of 16 bit DOS days where there were really few standards. See <http://wyw.dcweb.cn/stdcall.htm> for some more information. > Thanks for trying, Brian. I can tell you know what you're talking about. > Unfortunately I'm still completely in the dark. Really, it's not that complicated. "decorations" in this context commonly means a leading underscore and/or a trailing "@nn". It's a simple case of looking at the symbols in the library, and then looking at the gcc assembler output (-save-temps) and making the two match. If they differ, then you create an import library that provides the necessary aliases to make things match up. That is, after you've confirmed that your header declares each function prototype with the correct calling convention -- that should be step one, because there is *nothing* you can do with linker silliness or def files or whatever to change the calling convention that the compiler used, and so using .def file tricks to force a cdecl caller to link to a stdcall function is just going to cause a horrible crash. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
Re: How to link with third party libraries using gccWell, I think I'm about at the end of my road. My purpose for trying cygwin was to see if it could insulate me from having to learn to program on Windows. But if I've got to go to MSNBC (or whatever) or google the internet to figure out the internals of Windows then that defeats my purpose. I'm too close to the end of my career for that. I have no interest in Windows anyway.
I am amazed at what the Cygwin programmers have accomplished. They're obviously very capable programmers. But if I have to learn Windows to use cygwin then what's the use? I might as well just learn the Windows programming tools. They're easy to use, or so I'm told. I am glad cygwin enables me to run "vi" on Windows. That alone is very useful. The Unix utilities are nice too! Thanks for your suggestions.
|
|
|
RE: How to link with third party libraries using gccOn 28 June 2007 19:53, km4hr wrote:
> Well, I think I'm about at the end of my road. My purpose for trying cygwin > was to see if it could insulate me from having to learn to program on > Windows. But if I've got to go to MSNBC (or whatever) or google the internet > to figure out the internals of Windows then that defeats my purpose. I'm > too close to the end of my career for that. I have no interest in Windows > anyway. > > I am amazed at what the Cygwin programmers have accomplished. They're > obviously very capable programmers. But if I have to learn Windows to use > cygwin then what's the use? I might as well just learn the Windows > programming tools. They're easy to use, or so I'm told. You have a fundamental misunderstanding here. You don't need to learn windows. You can take bog-standard *nix/posix packages, compile link and run them using gcc, with no problems. However, what you're trying to do here is combine cygwin code and non-cygwin code into one program. That is incredibly hard, and it's not cygwin's fault; you're doing the same as if you were compiling a program on a linux box and you decided to try and link in a windows dll and get some of the functions from it to work. It's very very difficult to mix these incompatible things together, and requires deep knowledge of the platform, the toolchain, and how they interact. It's not brain science, but it /is/ rocket surgery. In other words, you're going at this the wrong way. If you just treat cygwin as a Unix environment and use it like that, it'd work exactly how you expect without any of this complication. What exactly are these libraries, what is the product that they're part of, and what is the /actual/ goal you're trying to get your program to achieve? cheers, DaveK -- Can't think of a witty .sigline today.... -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
Re: How to link with third party libraries using gcckm4hr wrote:
> Well, I think I'm about at the end of my road. My purpose for trying cygwin > was to see if it could insulate me from having to learn to program on > Windows. But if I've got to go to MSNBC (or whatever) or google the internet > to figure out the internals of Windows then that defeats my purpose. I'm > too close to the end of my career for that. I have no interest in Windows > anyway. > > I am amazed at what the Cygwin programmers have accomplished. They're > obviously very capable programmers. But if I have to learn Windows to use > cygwin then what's the use? I might as well just learn the Windows > programming tools. They're easy to use, or so I'm told. > > I am glad cygwin enables me to run "vi" on Windows. That alone is very > useful. The Unix utilities are nice too! > > Thanks for your suggestions. I'm glad you found it useful. I think you're proceeding from a false assumption about Cygwin though. Cygwin is an emulation layer that will insulate your from much of the differences between Windows and Linux if you work entirely within it's confines. It will insulate you somewhat if you straddle the line between Cygwin and Windows. You're in the camp of the latter because you're working with a lib created on Windows for Windows by Windows tools. If that's a problem for you, you have the option of building the library from source using Cygwin. Then you will have none of the problems you were noticing. I expect that's not of interest (or possible) to you either but I thought it worthwhile to point out. You're still getting allot of insulation, no matter how you look at it though. You don't have to learn the Win32 API or anything. :-) -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _____________________________________________________________________ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
Re: How to link with third party libraries using gccI agree, Cygwin is certainly useful in many ways. The developers have done the rest of us a huge service. After re-reading my previous post I felt I may have come down too hard on Cygwin. I didn't mean to do that. The programming I do is relatively simple. But I appreciate the complexities involved in getting Windows and Unix to virtually live together on the same computer. I have no idea how cygwin does that. But with all the complex obstacles that the cygwin developers have obviously overcome it's puzzling to me why something as seemingly ordinary as Windows libraries is so mystifying. In just this one series of messages I've been told the instructions in the cygwin user's guide make no sense. Then I'm offered several opinions about what I should do. It makes me wonder how Windows' own programming tools are able to link with their own libraries if the standards are so vague and haphazard. I guess I'll just add one more entry to the list of things I can't comprehend about Windows. I'm ok with that because I don't care about Windows anyway. Thanks again from enlightening me. |
|
|
RE: How to link with third party libraries using gccOn 29 June 2007 15:26, km4hr wrote:
> computer. I have no idea how cygwin does that. But with all the complex > obstacles that the cygwin developers have obviously overcome it's puzzling > to me why something as seemingly ordinary as Windows libraries is so > mystifying. Because they are *windows* libraries, not *cygwin* libraries. The two are *different*. > In just this one series of messages I've been told the > instructions in the cygwin user's guide make no sense. The instructions in the user's guide do not address the incredibly tricky and unreliable thing you are trying to do. > Then I'm offered > several opinions about what I should do. No, you have been told the /same/ things by several people, but you just aren't listening. > It makes me wonder how Windows' own > programming tools are able to link with their own libraries if the standards > are so vague and haphazard. They aren't "vague and haphazard", they are precise, and explicit - and INCOMPATIBLE. Each standard is entirely consistent, but YOU ARE TRYING TO MIX TWO DIFFERENT STANDARDS. > I guess I'll just add one more entry to the > list of things I can't comprehend about Windows. I'm ok with that because I > don't care about Windows anyway. > > Thanks again from enlightening me. Don't really think you've understood a word so far. Once more, I'll suggest you try thinking of it this way: how easy would you find it to link a windows DLL into a program running on your unix box? Because that is equivalent to what you are trying to do. cheers, DaveK -- Can't think of a witty .sigline today.... -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
RE: How to link with third party libraries using gccDave,
The libraries I'm dealing with provide an C programming interface to an industrial control system. The system is a Fisher DCS (distributed control system). The DCS contains thousands of temperatures, pressures, flowrates, etc from processes in our plant. I create programs that access that information. My programs analyze the info to evaluate production efficiencies, reporting, performance testing, etc. The Fisher libraries are available on Unix,VMS, and Windows. I use the Unix version. But there are times when it would be convenient to run the programs on Windows. I just don't want to learn the Windows programming environment. So I was experimenting with cygwin to see if there might be some magic that could allow the transfer of programs from Unix to Windows easily. I wish there was a Linux version of the Fisher libraries. But the product now has "legacy" status and Fisher has no intention of creating a Linux version. Fisher became convinced a few years ago that Windows was the "way of the future". So much so that they based their entire new product line on it. They thought Unix was dead. Now with Linux becoming ever more popular the folks at Fisher are paranoid. They don't want to hear the word Linux. (If anyone has any idea how to reverse engineer such a library I'd love to hear about it!)
|
|
|
RE: How to link with third party libraries using gccOn 29 June 2007 16:19, km4hr wrote:
> Dave, > > The libraries I'm dealing with provide an C programming interface to an > industrial control system. The system is a Fisher DCS (distributed control > system). The DCS contains thousands of temperatures, pressures, flowrates, > etc from processes in our plant. I create programs that access that > information. My programs analyze the info to evaluate production > efficiencies, reporting, performance testing, etc. The Fisher libraries are > available on Unix,VMS, and Windows. I use the Unix version. But there are > times when it would be convenient to run the programs on Windows. I just > don't want to learn the Windows programming environment. So I was > experimenting with cygwin to see if there might be some magic that could > allow the transfer of programs from Unix to Windows easily. Alas, no. The problem here is that cygwin is not just-plain-windoze. The libraries you have are build with standard windoze tools, they link against the MSVC runtime, expect to have their own malloc heap, file handle table, thread handling, etc etc... whereas cygwin, in order to provide posix emulation at the recompile-your-source-and-it-just-works level, requires to control all those things on behalf of your code. The foreign libraries will go behind its back and confuse it. You would need a version of those libraries built and linked against cygwin and then the porting would be easy, you'd just recompile and run. In this situation, probably your best bet for posix portability plus compatibility with native win32 libraries would be to use MSYS and MinGW to recompile your unix programs. They are based around the windoze native (MSVC) runtime and libraries. The downside is that they don't provide as much of the posix api as cygwin does, because they can't do all the emulation that cygwin does; the plus-side is that they're compatible with native builds. So you might need to sprinkle a few #ifdefs through your code to avoid tricky functions that MSYS/MinGW don't support, but other than that you might be in luck. You'll have to ask on a MSYS/MinGW mailing list for further advice about this, it's not our speciality here, but it might well do what you need. cheers, DaveK -- Can't think of a witty .sigline today.... -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
RE: How to link with third party libraries using gccDave,
You're right. I'm not listening. At least not entirely. The only thing I really needed to hear was that this is an "incredibly tricky and unreliable thing ... to do". Thanks for being up front about that!
|
|
|
RE: How to link with third party libraries using gcc> -----Original Message-----
> From: cygwin-owner@... > [mailto:cygwin-owner@...] On Behalf Of km4hr > Sent: Friday, June 29, 2007 11:19 AM > To: cygwin@... > Subject: RE: How to link with third party libraries using gcc > > > Dave, > > The libraries I'm dealing with provide an C programming > interface to an > industrial control system. The system is a Fisher DCS > (distributed control > system). The DCS contains thousands of temperatures, > pressures, flowrates, > etc from processes in our plant. I create programs that access that > information. My programs analyze the info to evaluate production > efficiencies, reporting, performance testing, etc. The > Fisher libraries are > available on Unix,VMS, and Windows. I use the Unix version. > But there are > times when it would be convenient to run the programs on > Windows. I just > don't want to learn the Windows programming environment. So I was > experimenting with cygwin to see if there might be some magic > that could > allow the transfer of programs from Unix to Windows easily. > > I wish there was a Linux version of the Fisher libraries. But > the product > now has "legacy" status and Fisher has no intention of > creating a Linux > version. Fisher became convinced a few years ago that Windows > was the "way > of the future". So much so that they based their entire new > product line on > it. They thought Unix was dead. Now with Linux becoming ever > more popular > the folks at Fisher are paranoid. They don't want to hear the > word Linux. > (If anyone has any idea how to reverse engineer such a > library I'd love to > hear about it!) Whether the libraries are linked dynamic or static is irrelevant here. The Windows libraries are stored in a different object format than the Unix and Cygwin libraries, and probably have different calling conventions. You can't use MS-Windows libraries without the appropriate tools, usually that means Visual Studio. Cygwin made no attempt to be compatible at that level, likely because both the API and calling conventions are so different. Have you tried to use them under wine or don't you have a full MS-Windows application built? Bob McConnell N2SPP -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
Re: How to link with third party libraries using gccBob McConnell wrote:
<snip> > > Whether the libraries are linked dynamic or static is irrelevant here. > The Windows libraries are stored in a different object format than the > Unix and Cygwin libraries, and probably have different calling The format of Windows and Cygwin libraries are the same. > conventions. You can't use MS-Windows libraries without the appropriate > tools, usually that means Visual Studio. Cygwin made no attempt to be You can use MS-Windows libraries with Cygwin. Look under the hood of Cygwin and you'll see Windows API calls. The typical problems are matching the calling conventions and managing resources (heap, etc), as Dave has already pointed out. But it's possible, as Cygwin itself illustrates. > compatible at that level, likely because both the API and calling > conventions are so different. > <snip> -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _____________________________________________________________________ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
RE: How to link with third party libraries using gcc> -----Original Message-----
> From: cygwin-owner@... > [mailto:cygwin-owner@...] On Behalf Of Larry Hall (Cygwin) > Sent: Friday, June 29, 2007 2:37 PM > To: cygwin@... > Subject: Re: How to link with third party libraries using gcc > > Bob McConnell wrote: > > <snip> > > > > Whether the libraries are linked dynamic or static is > irrelevant here. > > The Windows libraries are stored in a different object > format than the > > Unix and Cygwin libraries, and probably have different calling > > The format of Windows and Cygwin libraries are the same. > > > conventions. You can't use MS-Windows libraries without the > appropriate > > tools, usually that means Visual Studio. Cygwin made no > attempt to be > > You can use MS-Windows libraries with Cygwin. Look under the > hood of Cygwin > and you'll see Windows API calls. The typical problems are > matching the > calling conventions and managing resources (heap, etc), as > Dave has already > pointed out. But it's possible, as Cygwin itself illustrates. So you are suggesting that with the proper header files and a little fiddling I could build and run a Visual Studio.Net project on top of the cygwin DLL and use additional Cygwin libraries in it? That is what it sounds like to me. As an application programmer, I don't look under the hood. I leave that to the kernel programmers that understand the intricacies involved. I already have enough trouble debugging some hardware vendors' libraries. I have attempted to go the other way, with no success. I tried to use Cygwin B.20 to write some MS-Windows services a few years ago. One was a simple TCP/IP socket proxy, and I never could get it to talk with the Service Control Manager. It took about two hours to get it running as a daemon on Slackware and half a day to port it into MSVC6. Bob McConnell -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
Re: How to link with third party libraries using gccOn Fri, Jun 29, 2007 at 03:31:14PM -0400, Bob McConnell wrote:
>I have attempted to go the other way, with no success. I tried to use >Cygwin B.20 to write some MS-Windows services a few years ago. One was a >simple TCP/IP socket proxy, and I never could get it to talk with the >Service Control Manager. It took about two hours to get it running as a >daemon on Slackware and half a day to port it into MSVC6. If you couldn't do it with Cygwin B20 then, then... No, the ramifications are just too horrible. I have to go lie down. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
|
|
Re: How to link with third party libraries using gccBob McConnell wrote:
>> -----Original Message----- >> From: cygwin-owner@... >> [mailto:cygwin-owner@...] On Behalf Of Larry Hall (Cygwin) >> Sent: Friday, June 29, 2007 2:37 PM >> To: cygwin@... >> Subject: Re: How to link with third party libraries using gcc >> >> Bob McConnell wrote: >> >> <snip> >>> Whether the libraries are linked dynamic or static is >> irrelevant here. >>> The Windows libraries are stored in a different object >> format than the >>> Unix and Cygwin libraries, and probably have different calling >> The format of Windows and Cygwin libraries are the same. >> >>> conventions. You can't use MS-Windows libraries without the >> appropriate >>> tools, usually that means Visual Studio. Cygwin made no >> attempt to be >> >> You can use MS-Windows libraries with Cygwin. Look under the >> hood of Cygwin >> and you'll see Windows API calls. The typical problems are >> matching the >> calling conventions and managing resources (heap, etc), as >> Dave has already >> pointed out. But it's possible, as Cygwin itself illustrates. > > So you are suggesting that with the proper header files and a little > fiddling I could build and run a Visual Studio.Net project on top of the > cygwin DLL and use additional Cygwin libraries in it? That is what it It is possible to have a Windows program link to and use cygwin1.dll but that's not what I was saying. I was saying that it's possible build a Cygwin app that uses Windows libs. > sounds like to me. As an application programmer, I don't look under the > hood. I leave that to the kernel programmers that understand the > intricacies involved. I already have enough trouble debugging some > hardware vendors' libraries. It's not always easy. Check that. It's often hard at least! > I have attempted to go the other way, with no success. I tried to use > Cygwin B.20 to write some MS-Windows services a few years ago. One was a > simple TCP/IP socket proxy, and I never could get it to talk with the > Service Control Manager. It took about two hours to get it running as a > daemon on Slackware and half a day to port it into MSVC6. Yes, this is the harder way to go. If you can, you're better off porting it with Mingw. However, if you're curious about what's involved here, take a look at the following FAQ link and/or documentation in the docs directory of the Cygwin source. <http://cygwin.com/faq/faq-nochunks.html#faq.programming.msvs-mingw> -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _____________________________________________________________________ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ |
| Free embeddable forum powered by Nabble | Forum Help |