www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - interfacing with the windows api

reply lee <lee_member pathlink.com> writes:
I'm trying to write a short windows application, and I need to define a windows
class object. In C this is simple since the class is defined in the windows
header file. Unfortunately, I can't create a wc object in my D program. I tried
importing the header file, but the class definition doesn't carry over into the
program's namespace. Moreover, this is just part of a larger problem. I have
been experiencing problems importing user defined data types from C header files
in general. If someone could explain how D interfaces with C code, I would
really appreciate it. 
Thanks
Lee 
Feb 21 2006
next sibling parent reply "John C" <johnch_atms hotmail.com> writes:
"lee" <lee_member pathlink.com> wrote in message 
news:dteims$1198$1 digitaldaemon.com...
 I'm trying to write a short windows application, and I need to define a 
 windows
 class object. In C this is simple since the class is defined in the 
 windows
 header file. Unfortunately, I can't create a wc object in my D program. I 
 tried
 importing the header file, but the class definition doesn't carry over 
 into the
 program's namespace. Moreover, this is just part of a larger problem. I 
 have
 been experiencing problems importing user defined data types from C header 
 files
 in general. If someone could explain how D interfaces with C code, I would
 really appreciate it.
 Thanks
 Lee
Interfacing with C, and interfacing with C source code are two different things. This might help you: http://www.digitalmars.com/d/interfaceToC.html
Feb 21 2006
next sibling parent lee <lee_member pathlink.com> writes:
In article <dtencf$188h$1 digitaldaemon.com>, John C says...
"lee" <lee_member pathlink.com> wrote in message 
news:dteims$1198$1 digitaldaemon.com...
 I'm trying to write a short windows application, and I need to define a 
 windows
 class object. In C this is simple since the class is defined in the 
 windows
 header file. Unfortunately, I can't create a wc object in my D program. I 
 tried
 importing the header file, but the class definition doesn't carry over 
 into the
 program's namespace. Moreover, this is just part of a larger problem. I 
 have
 been experiencing problems importing user defined data types from C header 
 files
 in general. If someone could explain how D interfaces with C code, I would
 really appreciate it.
 Thanks
 Lee
Interfacing with C, and interfacing with C source code are two different things. This might help you: http://www.digitalmars.com/d/interfaceToC.html My problem isn't that I can't access functions defined in C header files, It's that I can't use user defined data types defined within those files. Even after I imported the header file, I still wasn't able to use classes that were defined within it.
Lee
Feb 21 2006
prev sibling parent reply lee <lee_member pathlink.com> writes:
In article <dtencf$188h$1 digitaldaemon.com>, John C says...
"lee" <lee_member pathlink.com> wrote in message 
news:dteims$1198$1 digitaldaemon.com...
 I'm trying to write a short windows application, and I need to define a 
 windows
 class object. In C this is simple since the class is defined in the 
 windows
 header file. Unfortunately, I can't create a wc object in my D program. I 
 tried
 importing the header file, but the class definition doesn't carry over 
 into the
 program's namespace. Moreover, this is just part of a larger problem. I 
 have
 been experiencing problems importing user defined data types from C header 
 files
 in general. If someone could explain how D interfaces with C code, I would
 really appreciate it.
 Thanks
 Lee
Interfacing with C, and interfacing with C source code are two different things. This might help you: http://www.digitalmars.com/d/interfaceToC.html I'm trying to access data types defined within c header files. I can access functions that are defined externally, But I haven't been able to gain access to class and variable declarations.
Lee
Feb 21 2006
parent "John C" <johnch_atms hotmail.com> writes:
"lee" <lee_member pathlink.com> wrote in message 
news:dtepfr$1afh$1 digitaldaemon.com...
 In article <dtencf$188h$1 digitaldaemon.com>, John C says...
"lee" <lee_member pathlink.com> wrote in message
news:dteims$1198$1 digitaldaemon.com...
 I'm trying to write a short windows application, and I need to define a
 windows
 class object. In C this is simple since the class is defined in the
 windows
 header file. Unfortunately, I can't create a wc object in my D program. 
 I
 tried
 importing the header file, but the class definition doesn't carry over
 into the
 program's namespace. Moreover, this is just part of a larger problem. I
 have
 been experiencing problems importing user defined data types from C 
 header
 files
 in general. If someone could explain how D interfaces with C code, I 
 would
 really appreciate it.
 Thanks
 Lee
Interfacing with C, and interfacing with C source code are two different things. This might help you: http://www.digitalmars.com/d/interfaceToC.html I'm trying to access data types defined within c header files. I can access functions that are defined externally, But I haven't been able to gain access to class and variable declarations.
Ok. The sentence "importing user defined data types from C header files" led me to that conclusion.
 Lee

 
Feb 21 2006
prev sibling parent reply Kyle Furlong <kylefurlong gmail.com> writes:
lee wrote:
 I'm trying to write a short windows application, and I need to define a windows
 class object. In C this is simple since the class is defined in the windows
 header file. Unfortunately, I can't create a wc object in my D program. I tried
 importing the header file, but the class definition doesn't carry over into the
 program's namespace. Moreover, this is just part of a larger problem. I have
 been experiencing problems importing user defined data types from C header
files
 in general. If someone could explain how D interfaces with C code, I would
 really appreciate it. 
 Thanks
 Lee 
 
 
RTFM, http://www.digitalmars.com/d/windows.html
Feb 21 2006
parent reply lee <lee_member pathlink.com> writes:
In article <dtep0n$19sj$1 digitaldaemon.com>, Kyle Furlong says...
lee wrote:
 I'm trying to write a short windows application, and I need to define a windows
 class object. In C this is simple since the class is defined in the windows
 header file. Unfortunately, I can't create a wc object in my D program. I tried
 importing the header file, but the class definition doesn't carry over into the
 program's namespace. Moreover, this is just part of a larger problem. I have
 been experiencing problems importing user defined data types from C header
files
 in general. If someone could explain how D interfaces with C code, I would
 really appreciate it. 
 Thanks
 Lee 
 
 
RTFM, http://www.digitalmars.com/d/windows.html
thanks for the reference. Unfortunately when I tried to compile it the debugger flaged several errors in the resulting obj file. Each of these errors involved undefined Symbols. For example The first error reads; 'winsamp.obj(winsamp) error 42: Symbol Undefined _SelectObject 8' I moved a copy of winsamp.d into the same directory as dmd.exe, and I tried compiling it with the line ; 'dmd winsamp.d' Is there anything wrong with the source code. Or did I compile it wrong?
Feb 21 2006
next sibling parent "Chris Miller" <chris dprogramming.com> writes:
On Tue, 21 Feb 2006 05:38:44 -0500, lee <lee_member pathlink.com> wrote:

 Unfortunately when I tried to compile it the debugger flaged several  
 errors in
 the resulting obj file. Each of these errors involved undefined Symbols.  
 For
 example The first error reads;
 'winsamp.obj(winsamp)
 error 42: Symbol Undefined _SelectObject 8'

 I moved a copy of winsamp.d into the same directory as dmd.exe, and I  
 tried
 compiling it with the line ;
 'dmd winsamp.d'

 Is there anything wrong with the source code. Or did I compile it wrong?
Try: dmd winsamp.d gdi32.lib
Feb 21 2006
prev sibling parent lee <lee_member pathlink.com> writes:
In article <dteqjk$1biu$1 digitaldaemon.com>, lee says...
In article <dtep0n$19sj$1 digitaldaemon.com>, Kyle Furlong says...
lee wrote:
 I'm trying to write a short windows application, and I need to define a windows
 class object. In C this is simple since the class is defined in the windows
 header file. Unfortunately, I can't create a wc object in my D program. I tried
 importing the header file, but the class definition doesn't carry over into the
 program's namespace. Moreover, this is just part of a larger problem. I have
 been experiencing problems importing user defined data types from C header
files
 in general. If someone could explain how D interfaces with C code, I would
 really appreciate it. 
 Thanks
 Lee 
 
 
RTFM, http://www.digitalmars.com/d/windows.html
thanks for the reference. Unfortunately when I tried to compile it the debugger flaged several errors in the resulting obj file. Each of these errors involved undefined Symbols. For example The first error reads; 'winsamp.obj(winsamp) error 42: Symbol Undefined _SelectObject 8' I moved a copy of winsamp.d into the same directory as dmd.exe, and I tried compiling it with the line ; 'dmd winsamp.d' Is there anything wrong with the source code. Or did I compile it wrong? Ok, I made a mistake compiling the files. To get it to compile correctly I needed to have typed;
' dmd winsamp.d gdi32.lib winsamp.def ' thanks for the help :)
Feb 21 2006