Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
February 21, 2006 interfacing with the windows api | ||||
---|---|---|---|---|
| ||||
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 |
February 21, 2006 Re: interfacing with the windows api | ||||
---|---|---|---|---|
| ||||
Posted in reply to lee | "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 |
February 21, 2006 Re: interfacing with the windows api | ||||
---|---|---|---|---|
| ||||
Posted in reply to lee | 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 |
February 21, 2006 Re: interfacing with the windows api | ||||
---|---|---|---|---|
| ||||
Posted in reply to John C | 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 |
February 21, 2006 Re: interfacing with the windows api | ||||
---|---|---|---|---|
| ||||
Posted in reply to John C | 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 |
February 21, 2006 Re: interfacing with the windows api | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kyle Furlong | 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? |
February 21, 2006 Re: interfacing with the windows api | ||||
---|---|---|---|---|
| ||||
Posted in reply to lee | 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
|
February 21, 2006 Re: interfacing with the windows api | ||||
---|---|---|---|---|
| ||||
Posted in reply to lee | 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 :) |
February 21, 2006 Re: interfacing with the windows api | ||||
---|---|---|---|---|
| ||||
Posted in reply to lee | "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 > > |
Copyright © 1999-2021 by the D Language Foundation