www.digitalmars.com         C & C++   DMDScript  

D - Quickquestion

reply "Charles Sanders" <sanders-consulting comcast.net> writes:
If i use implib on a dll created by MSVC, do I need to declare the functions
extern (Windows) in my .d file ?


C
Oct 08 2003
parent reply Ant <Ant_member pathlink.com> writes:
In article <bm1pcg$b79$1 digitaldaemon.com>, Charles Sanders says...
If i use implib on a dll created by MSVC, do I need to declare the functions
extern (Windows) in my .d file ?

Of course. The compiler needs to know what you're talking about. You can't have undeclared symbols. Ant
Oct 08 2003
parent reply "Charles Sanders" <sanders-consulting comcast.net> writes:
I mean is it extern (Windows ) or extern (C )

C
"Ant" <Ant_member pathlink.com> wrote in message
news:bm1rv2$enc$1 digitaldaemon.com...
 In article <bm1pcg$b79$1 digitaldaemon.com>, Charles Sanders says...
If i use implib on a dll created by MSVC, do I need to declare the


extern (Windows) in my .d file ?

Of course. The compiler needs to know what you're talking about. You can't have undeclared symbols. Ant

Oct 08 2003
next sibling parent reply Ant <Ant_member pathlink.com> writes:
In article <bm1t0n$g3b$1 digitaldaemon.com>, Charles Sanders says...
I mean is it extern (Windows ) or extern (C )

That's a good question. I don't even know why we have (windows) I just found an explanation on the D pages. probably reading it would answer that question. Ant
Oct 08 2003
parent "Vathix" <vathix dprogramming.com> writes:
"Ant" <Ant_member pathlink.com> wrote in message
news:bm1ur5$ihi$1 digitaldaemon.com...
 In article <bm1t0n$g3b$1 digitaldaemon.com>, Charles Sanders says...
I mean is it extern (Windows ) or extern (C )

That's a good question. I don't even know why we have (windows) I just found an explanation on the D pages. probably reading it would answer that question. Ant

A DLL exported function can have any extern.. you just have to use the same one when calling it. By default in your C code, the calling convention is cdecl, which in D is extern(C), or you can specify stdcall in the C code (commonly implemented as __stdcall) and use extern(Windows) in D. It's just most common to use stdcall for DLLs.
Oct 08 2003
prev sibling parent reply "Sean L. Palmer" <palmer.sean verizon.net> writes:
If the C dll uses __cdecl convention, use extern (C), and if it uses
__stdcall convention, use extern (Windows).  If it uses __fastcall, you're
hosed.  ;)

Sean

"Charles Sanders" <sanders-consulting comcast.net> wrote in message
news:bm1t0n$g3b$1 digitaldaemon.com...
 I mean is it extern (Windows ) or extern (C )

 C
 "Ant" <Ant_member pathlink.com> wrote in message
 news:bm1rv2$enc$1 digitaldaemon.com...
 In article <bm1pcg$b79$1 digitaldaemon.com>, Charles Sanders says...
If i use implib on a dll created by MSVC, do I need to declare the


extern (Windows) in my .d file ?

Of course. The compiler needs to know what you're talking about. You can't have undeclared symbols. Ant


Oct 08 2003
parent "Charles Sanders" <sanders-consulting comcast.net> writes:
Ahh thanks, sorry think ive asked this before but forgot :).

C

"Sean L. Palmer" <palmer.sean verizon.net> wrote in message
news:bm1vac$j8s$1 digitaldaemon.com...
 If the C dll uses __cdecl convention, use extern (C), and if it uses
 __stdcall convention, use extern (Windows).  If it uses __fastcall, you're
 hosed.  ;)

 Sean

 "Charles Sanders" <sanders-consulting comcast.net> wrote in message
 news:bm1t0n$g3b$1 digitaldaemon.com...
 I mean is it extern (Windows ) or extern (C )

 C
 "Ant" <Ant_member pathlink.com> wrote in message
 news:bm1rv2$enc$1 digitaldaemon.com...
 In article <bm1pcg$b79$1 digitaldaemon.com>, Charles Sanders says...
If i use implib on a dll created by MSVC, do I need to declare the


extern (Windows) in my .d file ?

Of course. The compiler needs to know what you're talking about. You can't have undeclared symbols. Ant



Oct 08 2003