DirectX8/DirectInput + cygwin
Hello there, I've searched the archives high and low and can't seem to find a solution to my problem. When compiling a DirectInput8 function such as DirectInput8Create() I get an error linking: Unable to resolve DirectInput8Create@20 I am linking directly with the .lib files supplied by Microsoft, and all the Directx8 GUID references seem to link fine so does anybody have any idea what the problem might be? What version of DirectX are the directX libs in /usr/libs/ created for? As an extra note, gcc v3.00-3.02 won't compile unknwn.h without an internal compiler error, but v3.03 seems fine. Regards - Q-Games, Dylan Cuthbert. http://www.q-games.com -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
Sounds like a DEF file problem. Functions in DLLs use a different naming convention from C++ mangled names and C identifiers, usually: FunctionName@ArgSize ...where ArgSize is the total size of all the parameters arguments, say for example a function MyFunction taking a single pointer as a parameter would be MyFunction@4. .DEF files are what Visual C++ uses to associate functions in header files with functions in DLLs, I'm not sure what the Cygwin equivalents are. In fact, I know almost nothing about Cygwin but a lot about Windows DLLs, but I thought this might put you on the right track ;) -Wade Wednesday, February 06, 2002, 2:22:09 AM, you wrote: DC Hello there, DC I've searched the archives high and low and can't seem to find a solution to DC my problem. DC When compiling a DirectInput8 function such as DirectInput8Create() I get an DC error linking: DC Unable to resolve DirectInput8Create@20 DC I am linking directly with the .lib files supplied by Microsoft, and all the DC Directx8 GUID references seem to link fine so does anybody have any idea DC what the problem might be? DC What version of DirectX are the directX libs in /usr/libs/ created for? DC As an extra note, gcc v3.00-3.02 won't compile unknwn.h without an internal DC compiler error, but v3.03 seems fine. DC Regards DC - DC Q-Games, Dylan Cuthbert. DC http://www.q-games.com DC -- DC Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple DC Bug reporting: http://cygwin.com/bugs.html DC Documentation: http://cygwin.com/docs.html DC FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
Thanks for the quick response. Right now I'm just passing in the .lib files directly into GCC for linking and I can see why there would be problems if VS uses a different name mangling algorithm after your explanation. However, I'm kind of stuck at how to go about converting the .lib files into the native .a lib files gcc uses. I can generate .def files by following the description on the cygwin homepage, but I still get the same linking errors. - Q-Games, Dylan Cuthbert. http://www.q-games.com - Original Message - From: Wade Brainerd [EMAIL PROTECTED] To: Dylan Cuthbert [EMAIL PROTECTED] Cc: Cygwin@Cygwin. Com [EMAIL PROTECTED] Sent: Wednesday, February 06, 2002 7:38 PM Subject: Re: DirectX8/DirectInput + cygwin Sounds like a DEF file problem. Functions in DLLs use a different naming convention from C++ mangled names and C identifiers, usually: FunctionName@ArgSize ...where ArgSize is the total size of all the parameters arguments, say for example a function MyFunction taking a single pointer as a parameter would be MyFunction@4. .DEF files are what Visual C++ uses to associate functions in header files with functions in DLLs, I'm not sure what the Cygwin equivalents are. In fact, I know almost nothing about Cygwin but a lot about Windows DLLs, but I thought this might put you on the right track ;) -Wade Wednesday, February 06, 2002, 2:22:09 AM, you wrote: DC Hello there, DC I've searched the archives high and low and can't seem to find a solution to DC my problem. DC When compiling a DirectInput8 function such as DirectInput8Create() I get an DC error linking: DC Unable to resolve DirectInput8Create@20 DC I am linking directly with the .lib files supplied by Microsoft, and all the DC Directx8 GUID references seem to link fine so does anybody have any idea DC what the problem might be? DC What version of DirectX are the directX libs in /usr/libs/ created for? DC As an extra note, gcc v3.00-3.02 won't compile unknwn.h without an internal DC compiler error, but v3.03 seems fine. DC Regards DC - DC Q-Games, Dylan Cuthbert. DC http://www.q-games.com DC -- DC Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple DC Bug reporting: http://cygwin.com/bugs.html DC Documentation: http://cygwin.com/docs.html DC FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
So have the direct3d/directsound .lib files that come with cygwin already been processed for use with C++? Or are they only useable from C too as you say? Regards - Q-Games, Dylan Cuthbert. http://www.q-games.com - Original Message - From: Barubary [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 06, 2002 8:11 PM Subject: Re: DirectX8/DirectInput + cygwin Getting DirectX to work from cygwin GCC essentially can't be done from C++, but can be done from C. It can't be done from C++ because of the way COM virtual tables work. GCC can't clone Visual C++'s method because Microsoft holds a U.S. patent on their exact method. Just try using MFC from GCC and you'll know exactly what I mean. In C, the virtual table system is done by actually creating the vtable structure in the header file, so this isn't a problem. If you modify the DirectX header files, you could fix this for C++, but you'd have to do -lpVtable all the time, like in C. GCC, or rather binutils, can't handle the Microsoft import library format. binutils of course has its own, so you could make your own from the DLL. If import libraries don't work, you could always GetProcAddress on DirectInputCreate8 after loading dinput8.dll. Then the problem becomes how to get to the weird global functions (D3DX matrix stuff, for instance). -- Barubary - Original Message - From: Dylan Cuthbert [EMAIL PROTECTED] To: Cygwin@Cygwin. Com [EMAIL PROTECTED] Sent: Wednesday, February 06, 2002 2:22 AM Subject: DirectX8/DirectInput + cygwin When compiling a DirectInput8 function such as DirectInput8Create() I get an error linking: Unable to resolve DirectInput8Create@20 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
On Wed, Feb 06, 2002 at 12:11:58PM +0100, Pavel Tsekov wrote: Dylan Cuthbert wrote: I am linking directly with the .lib files supplied by Microsoft, and all the Directx8 GUID references seem to link fine so does anybody have any idea what the problem might be? Why ? Link against those in /usr/lib. gcc doesn't understand the MS export libraries. Actually, gcc/ld should understand non-c++ import libraries. cgf -- Please do not send me personal email with cygwin questions. Use the resources at http://cygwin.com/ . -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
Christopher Faylor wrote: On Wed, Feb 06, 2002 at 12:11:58PM +0100, Pavel Tsekov wrote: Dylan Cuthbert wrote: I am linking directly with the .lib files supplied by Microsoft, and all the Directx8 GUID references seem to link fine so does anybody have any idea what the problem might be? Why ? Link against those in /usr/lib. gcc doesn't understand the MS export libraries. Actually, gcc/ld should understand non-c++ import libraries. Is this a new feature or I was missing something all the time ? What's the point of tools which build .a files from dlls ? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
On Wed, Feb 06, 2002 at 07:10:49PM +0100, Pavel Tsekov wrote: Christopher Faylor wrote: On Wed, Feb 06, 2002 at 12:11:58PM +0100, Pavel Tsekov wrote: Dylan Cuthbert wrote: I am linking directly with the .lib files supplied by Microsoft, and all the Directx8 GUID references seem to link fine so does anybody have any idea what the problem might be? Why ? Link against those in /usr/lib. gcc doesn't understand the MS export libraries. Actually, gcc/ld should understand non-c++ import libraries. Is this a new feature or I was missing something all the time ? What's the point of tools which build .a files from dlls ? If you have an existing .lib import library it should work fine with ld. This has been the case for years. This is not to say that there haven't been bugs over the years, but AFAIK, there aren't any in the current version of cygwin. If it helps you can rename foo.lib to libfoo.a so that you can add -lfoo to the command line. You can also link against the dll itself, in many cases: gcc -o foo.exe foo.c blah.dll cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
What about the more important problem that Microsoft's patented virtual table system, which COM uses, isn't supported by GCC? -- Barubary - Original Message - From: Christopher Faylor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 06, 2002 10:18 AM Subject: Re: DirectX8/DirectInput + cygwin On Wed, Feb 06, 2002 at 07:10:49PM +0100, Pavel Tsekov wrote: Christopher Faylor wrote: On Wed, Feb 06, 2002 at 12:11:58PM +0100, Pavel Tsekov wrote: Dylan Cuthbert wrote: I am linking directly with the .lib files supplied by Microsoft, and all the Directx8 GUID references seem to link fine so does anybody have any idea what the problem might be? Why ? Link against those in /usr/lib. gcc doesn't understand the MS export libraries. Actually, gcc/ld should understand non-c++ import libraries. Is this a new feature or I was missing something all the time ? What's the point of tools which build .a files from dlls ? If you have an existing .lib import library it should work fine with ld. This has been the case for years. This is not to say that there haven't been bugs over the years, but AFAIK, there aren't any in the current version of cygwin. If it helps you can rename foo.lib to libfoo.a so that you can add -lfoo to the command line. You can also link against the dll itself, in many cases: gcc -o foo.exe foo.c blah.dll cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
On Wed, Feb 06, 2002 at 12:20:23PM -0800, Barubary wrote: What about the more important problem that Microsoft's patented virtual table system, which COM uses, isn't supported by GCC? Aren't virtual tables a feature of C++? cgf - Original Message - From: Christopher Faylor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 06, 2002 10:18 AM Subject: Re: DirectX8/DirectInput + cygwin On Wed, Feb 06, 2002 at 07:10:49PM +0100, Pavel Tsekov wrote: Christopher Faylor wrote: On Wed, Feb 06, 2002 at 12:11:58PM +0100, Pavel Tsekov wrote: Dylan Cuthbert wrote: I am linking directly with the .lib files supplied by Microsoft, and all the Directx8 GUID references seem to link fine so does anybody have any idea what the problem might be? Why ? Link against those in /usr/lib. gcc doesn't understand the MS export libraries. Actually, gcc/ld should understand non-c++ import libraries. Is this a new feature or I was missing something all the time ? What's the point of tools which build .a files from dlls ? If you have an existing .lib import library it should work fine with ld. This has been the case for years. This is not to say that there haven't been bugs over the years, but AFAIK, there aren't any in the current version of cygwin. If it helps you can rename foo.lib to libfoo.a so that you can add -lfoo to the command line. You can also link against the dll itself, in many cases: gcc -o foo.exe foo.c blah.dll -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re[2]: DirectX8/DirectInput + cygwin
By the way, you can access the DirectX C interfaces (or any COM interface for that matter) from C++ by #defining CINTERFACE before including the header containing the interface. Also, you don't have to use lpVtable, you can always use the macros they provide (your preference). -Wade Wednesday, February 06, 2002, 3:11:14 AM, you wrote: B Getting DirectX to work from cygwin GCC essentially can't be done from C++, B but can be done from C. It can't be done from C++ because of the way COM B virtual tables work. GCC can't clone Visual C++'s method because Microsoft B holds a U.S. patent on their exact method. Just try using MFC from GCC and B you'll know exactly what I mean. B In C, the virtual table system is done by actually creating the vtable B structure in the header file, so this isn't a problem. If you modify the B DirectX header files, you could fix this for C++, but you'd have to do -lpVtable all the time, like in C. B GCC, or rather binutils, can't handle the Microsoft import library format. B binutils of course has its own, so you could make your own from the DLL. B If import libraries don't work, you could always GetProcAddress on B DirectInputCreate8 after loading dinput8.dll. Then the problem becomes how B to get to the weird global functions (D3DX matrix stuff, for instance). B -- Barubary B - Original Message - B From: Dylan Cuthbert [EMAIL PROTECTED] B To: Cygwin@Cygwin. Com [EMAIL PROTECTED] B Sent: Wednesday, February 06, 2002 2:22 AM B Subject: DirectX8/DirectInput + cygwin When compiling a DirectInput8 function such as DirectInput8Create() I get B an error linking: Unable to resolve DirectInput8Create@20 B -- B Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple B Bug reporting: http://cygwin.com/bugs.html B Documentation: http://cygwin.com/docs.html B FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
Aren't virtual tables a feature of C++? cgf I'm talking about the specific implementation of the virtual table - the layout of the function pointers relative to the this pointer. The location and format of the vtable relative to the this pointer in Visual C++ is patented by Microsoft. I wish I knew the patent number... -- Barubary -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
On Wed, Feb 06, 2002 at 02:24:57PM -0800, Barubary wrote: Aren't virtual tables a feature of C++? I'm talking about the specific implementation of the virtual table - the layout of the function pointers relative to the this pointer. The location and format of the vtable relative to the this pointer in Visual C++ is patented by Microsoft. I wish I knew the patent number... I'm talking about the fact that I said that non-c++ import libraries should work correctly. You countered with a question about Microsoft's patented virtual table system. If the virtual table system is used in non-c++ libraries then this is an issue. Otherwise, again, non-c++ import libraries should work ok with 'ld'. The reason that I said non-c++ is specifically because gcc/gas/ld don't understand Microsoft's C++ object file layout. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: MS C++ Patent (WAS: DirectX8/DirectInput + cygwin)
Hi, I'm talking about the specific implementation of the virtual table - the layout of the function pointers relative to the this pointer. The location and format of the vtable relative to the this pointer in Visual C++ is patented by Microsoft. I wish I knew the patent number... I think it's US Patent 5,297,284, Method and system for implementing virtual functions and virtual base classes and setting a this pointer for an object-oriented programming language. Here's a direct URL (split over 4 lines 'cos it was too long): http://patft.uspto.gov/netacgi/nph-Parser? Sect1=PTO1Sect2=HITOFFd=PALLp=1 u=/netahtml/srchnum.htmr=1f=Gl=50s1='5297284'.WKU. OS=PN/5297284RS=PN/5297284 Standard disclaimer applies to this post - I am not a lawyer. :-P Regards, Jon -- The knack of flying is learning how to throw yourself at the ground and miss. - Hitchhiker's Guide to the Galaxy E-mail: [EMAIL PROTECTED] web: http://www.jon-foster.co.uk/ - Original Message - Barubary [EMAIL PROTECTED] wrote: Aren't virtual tables a feature of C++? cgf I'm talking about the specific implementation of the virtual table - the layout of the function pointers relative to the this pointer. The location and format of the vtable relative to the this pointer in Visual C++ is patented by Microsoft. I wish I knew the patent number... -- Barubary -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
If this is the case, does this mean the problem I'm getting with DirectInput8Create@20 not being found is due to differences in C++ name mangling as another poster mentioned only C libraries being able to link. Linking directly with the DirectX SDK .lib files cleared up all the unresolved errors apart from just this single one, but I'm only calling a few directx function calls as a test so presumably I'll come across the same problem when I start using more function calls. Thanks for the help, I feel I'm getting a few starting points to try out. - Q-Games, Dylan Cuthbert. http://www.q-games.com - Original Message - From: Christopher Faylor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 3:18 AM Subject: Re: DirectX8/DirectInput + cygwin On Wed, Feb 06, 2002 at 07:10:49PM +0100, Pavel Tsekov wrote: Christopher Faylor wrote: On Wed, Feb 06, 2002 at 12:11:58PM +0100, Pavel Tsekov wrote: Dylan Cuthbert wrote: I am linking directly with the .lib files supplied by Microsoft, and all the Directx8 GUID references seem to link fine so does anybody have any idea what the problem might be? Why ? Link against those in /usr/lib. gcc doesn't understand the MS export libraries. Actually, gcc/ld should understand non-c++ import libraries. Is this a new feature or I was missing something all the time ? What's the point of tools which build .a files from dlls ? If you have an existing .lib import library it should work fine with ld. This has been the case for years. This is not to say that there haven't been bugs over the years, but AFAIK, there aren't any in the current version of cygwin. If it helps you can rename foo.lib to libfoo.a so that you can add -lfoo to the command line. You can also link against the dll itself, in many cases: gcc -o foo.exe foo.c blah.dll cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
Thanks folks - I found a mirror for the dx8 libs on Peter Puck's web site - http://rain.prohosting.com/urebel/download.html Also, Peter Puck's web site is down at the moment - hopefully it will come back up: it is: http://sites.netscape.net/ptrpck/directx.htm I'll try installing these today and see if I can make some progress, thanks to everyone for their quick response! I'll send a DirectX section to the FAQ maintainer once I get all this working as a kind of payback. Regards - Q-Games, Dylan Cuthbert. http://www.q-games.com - Original Message - From: andy younger [EMAIL PROTECTED] To: Barubary [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 9:30 AM Subject: Re: DirectX8/DirectInput + cygwin Peter Puck has already made bindings for Direct X 8. The site appears to be down at the moment, but if you google for dx8 Peter Puck you can probably find them, I believe these are MingW bindings, but they work fine with cygwin. Contrary to popular belief you can use the COM/C++ bindings. Gcc's default way of doing thunking is different than visual C's, but if you use the compiler option -fvtable-thunks it uses the vtable method. Due to this being a ABI change, you will need to build all your source files with this. This obviously does not fix the name mangling incompatibilities with Visual C, but on a COM interface such as DX, this does not matter. The biggest problem you will have are with DirectShow, and the D3DX libraries. DirectShow (or whatever it is called these days) has a C++ interface to it, and as such will only work with visual C's mangling scheme. So no joy there.. With D3DX, the problem is that the libraries are statically linked, and use Visual C++'s name mangling scheme for most of the internal symbols. This leaves them somewhat useless for any compiler rather than Visual C. There are 2 solutions to this. - don't use them, they are convenient, but not essential to DX programming. - Make a wrapper DLL for them with visual C. I believe someone has already done this to enable them to use the librarys in Borland C. A google search should yield some answers. Cheers, Andy -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: DirectX8/DirectInput + cygwin
On Thu, 2002-02-07 at 07:32, Christopher Faylor wrote: On Wed, Feb 06, 2002 at 12:20:23PM -0800, Barubary wrote: What about the more important problem that Microsoft's patented virtual table system, which COM uses, isn't supported by GCC? Aren't virtual tables a feature of C++? Yes and no. [D]COM[++], which is not C++, also uses virtual tables for in-process objects and in-process object stubs. (stubs are used where the obejct doesn't directly implement an in-process capability, or it's being invoked remotely). However, AFAIK (not an expert) that shouldn't be an issue for us, as all COM linking is done at run-time, not statically... Rob -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/