www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Need help converting basic COM program from C++ to D

reply "Chris Burt-Brown" <brokenbeta+newsgroups gmail.com> writes:
Hi, this my first post and I'm a little lost so please excuse my missteps.

I am trying to implement this basic little program:

http://msdn.microsoft.com/en-us/library/ms783787(VS.85).aspx

This is a DirectShow "hello world" and I have been looking around for anyone 
who has actually connected to DirectShow through D, but it doesn't appear to 
have been done. I'm sure that I can cope with a more complex example if I 
can get the basics down.

I've searched around and found various other cries for help relating for 
COM; they have only served to confuse me further :( and the section on COM 
on the Digital Mars website is ... erm, disappointingly brief.

I know that this one's a tricky one. Even the slightest nod in a direction 
will be appreciated.
Thank you very much.

Chris 
Aug 07 2008
next sibling parent reply Wyverex <wyverex.cypher gmail.com> writes:
Chris Burt-Brown wrote:
 Hi, this my first post and I'm a little lost so please excuse my missteps.
 
 I am trying to implement this basic little program:
 
 http://msdn.microsoft.com/en-us/library/ms783787(VS.85).aspx
 
 This is a DirectShow "hello world" and I have been looking around for anyone 
 who has actually connected to DirectShow through D, but it doesn't appear to 
 have been done. I'm sure that I can cope with a more complex example if I 
 can get the basics down.
 
 I've searched around and found various other cries for help relating for 
 COM; they have only served to confuse me further :( and the section on COM 
 on the Digital Mars website is ... erm, disappointingly brief.
 
 I know that this one's a tricky one. Even the slightest nod in a direction 
 will be appreciated.
 Thank you very much.
 
 Chris 
 
 

There is a port for directX in the bindings project on dSource http://dsource.org/projects/bindings/browser/trunk/win32/directx Not complete but a good start.. Would be nice to get a complete port of DX though... Also a post about getting it to compile... http://dsource.org/forums/viewtopic.php?t=2217 Other possibility is to write a C dll file in Visual Studio then link to it....
Aug 07 2008
parent "Koroskin Denis" <2korden gmail.com> writes:
On Fri, 08 Aug 2008 03:03:01 +0400, Wyverex <wyverex.cypher gmail.com>  =

wrote:

 Chris Burt-Brown wrote:
 Hi, this my first post and I'm a little lost so please excuse my  =


 missteps.
  I am trying to implement this basic little program:
  http://msdn.microsoft.com/en-us/library/ms783787(VS.85).aspx
  This is a DirectShow "hello world" and I have been looking around fo=


 anyone who has actually connected to DirectShow through D, but it  =


 doesn't appear to have been done. I'm sure that I can cope with a mor=


 complex example if I can get the basics down.
  I've searched around and found various other cries for help relating=


 for COM; they have only served to confuse me further :( and the secti=


 on COM on the Digital Mars website is ... erm, disappointingly brief.=


  I know that this one's a tricky one. Even the slightest nod in a  =


 direction will be appreciated.
 Thank you very much.
  Chris

There is a port for directX in the bindings project on dSource http://dsource.org/projects/bindings/browser/trunk/win32/directx Not complete but a good start.. Would be nice to get a complete port of DX though... Also a post about getting it to compile... =

 http://dsource.org/forums/viewtopic.php?t=3D2217

 Other possibility is to write a C dll file in Visual Studio then link =

 it....

I'm using these binding and have no problems with them. There are two ways to resolve dll dependencies: 1) easiest one - create a dmd-compatible .lib file to link with your = application. There is a coffimplib utility could be used for that. Grab it here: = = ftp://ftp.digitalmars.com/coffimplib.zip (thanks to Sascha Katzner for t= he = hint!) 2) write a .def file that eplicitly enumerates all the dependencies. I.e= . = if you have an error like this:
 Error 42: Symbol Undefined _Direct3DCreate9 4

 _Direct3DCreate9 4=3Dd3d9.Direct3DCreate9

.def file should be linked with an application, too. I use both and I added my .def files for directx to the SVN in case anyo= ne = would need them. Hope this helps.
Aug 07 2008
prev sibling next sibling parent jcc7 <technocrat7 gmail.com> writes:
== Quote from Chris Burt-Brown (brokenbeta+newsgroups gmail.com)'s article
 Hi, this my first post and I'm a little lost so please excuse my
 missteps.

 I am trying to implement this basic little program:

 http://msdn.microsoft.com/en-us/library/ms783787(VS.85).aspx

 This is a DirectShow "hello world" and I have been looking around
 for anyone who has actually connected to DirectShow through D, but
 it doesn't appear to have been done. I'm sure that I can cope with a
 more complex example if I can get the basics down.

 I've searched around and found various other cries for help relating
 for COM; they have only served to confuse me further :( and the
 section on COM on the Digital Mars website is ... erm,
 disappointingly brief.

 I know that this one's a tricky one. Even the slightest nod in a
 direction will be appreciated.
 Thank you very much.

 Chris

I don't know anything about DirectShow in particular, but there are a couple projects that aim to facilitate using COM with D: * Juno (non-Tango): http://www.dsource.org/projects/juno * DWin (includes port of Juno for Tango): http://www.dsource.org/projects/dwin I don't know that either Juno or DWin has much beginner-level documentation on their websites, but you could probably get some tips via their respective forums (http://www.dsource.org/forums/).
Aug 08 2008
prev sibling parent reply =?ISO-8859-15?Q?S=F6nke_Ludwig?= writes:
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Chris Burt-Brown wrote:
 Hi, this my first post and I'm a little lost so please excuse my missteps.
 
 I am trying to implement this basic little program:
 
 http://msdn.microsoft.com/en-us/library/ms783787(VS.85).aspx
 
 This is a DirectShow "hello world" and I have been looking around for anyone 
 who has actually connected to DirectShow through D, but it doesn't appear to 
 have been done. I'm sure that I can cope with a more complex example if I 
 can get the basics down.
 
 I've searched around and found various other cries for help relating for 
 COM; they have only served to confuse me further :( and the section on COM 
 on the Digital Mars website is ... erm, disappointingly brief.
 
 I know that this one's a tricky one. Even the slightest nod in a direction 
 will be appreciated.
 Thank you very much.
 
 Chris 
 
 

I have tried to get DirectShow to work using D some time ago and created a header file which basically seems to work (offscreen frame grabber tested). Some prototypes are taken from the bindings project. However, if I remember right, all 'LONG' (32-bit) parameters were incorrectly ported as 'long' (64-bit) - so that had to be corrected. The only problem which remains is a crash with an enabled GC in my test app. I haven't had the time to debug this but it shouldn't be related to the header files. I'll attach the header files as is and could also post the DShow part of the test application if needed.
Aug 18 2008
parent Chris Burt-Brown <brokenbeta+newsgroups gmail.com> writes:
Sönke Ludwig Wrote:

 Chris Burt-Brown wrote:
 Hi, this my first post and I'm a little lost so please excuse my missteps.
 
 I am trying to implement this basic little program:
 
 http://msdn.microsoft.com/en-us/library/ms783787(VS.85).aspx
 
 This is a DirectShow "hello world" and I have been looking around for anyone 
 who has actually connected to DirectShow through D, but it doesn't appear to 
 have been done. I'm sure that I can cope with a more complex example if I 
 can get the basics down.
 
 I've searched around and found various other cries for help relating for 
 COM; they have only served to confuse me further :( and the section on COM 
 on the Digital Mars website is ... erm, disappointingly brief.
 
 I know that this one's a tricky one. Even the slightest nod in a direction 
 will be appreciated.
 Thank you very much.
 
 Chris 
 
 

I have tried to get DirectShow to work using D some time ago and created a header file which basically seems to work (offscreen frame grabber tested). Some prototypes are taken from the bindings project. However, if I remember right, all 'LONG' (32-bit) parameters were incorrectly ported as 'long' (64-bit) - so that had to be corrected. The only problem which remains is a crash with an enabled GC in my test app. I haven't had the time to debug this but it shouldn't be related to the header files. I'll attach the header files as is and could also post the DShow part of the test application if needed.

Oh, that's excellent! Thank you! I knew somebody on this crazy world had to have got there before me :-) I am now listening to a music file through D and the prospect of making this app has just got a lot more inviting. Thanks!
Aug 19 2008