changeset 201:96fb902700fe

casting function pointers Russ Lewis <spamhole-2001-07-16@deming-os.org> 2004-12-14 news:cpoao4$lqs$1@digitaldaemon.com nntp://news.digitalmars.com/digitalmars.D.bugs:2556
author thomask
date Wed, 15 Dec 2004 17:36:14 +0000
parents 5cc3c4e2a391
children 4cd33115f015
files compile/extern_07.d nocompile/extern_06.d
diffstat 2 files changed, 41 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compile/extern_07.d	Wed Dec 15 17:36:14 2004 +0000
@@ -0,0 +1,20 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Russ Lewis <spamhole-2001-07-16@deming-os.org>
+// @date@	2004-12-14
+// @uri@	news:cpoao4$lqs$1@digitaldaemon.com
+// @url@	nntp://news.digitalmars.com/digitalmars.D.bugs:2556
+
+module dstress.compile.extern_07;
+
+extern(C) void *wglGetProcAddress(char*);
+extern(C) int function() glFunctionFoo;
+  
+int main(){
+	glFunctionFoo = cast(extern(C) int function()) wglGetProcAddress("glFunctionFoo");
+	return 0;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/extern_06.d	Wed Dec 15 17:36:14 2004 +0000
@@ -0,0 +1,21 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Russ Lewis <spamhole-2001-07-16@deming-os.org>
+// @date@	2004-12-14
+// @uri@	news:cpoao4$lqs$1@digitaldaemon.com
+// @url@	nntp://news.digitalmars.com/digitalmars.D.bugs:2556
+
+module dstress.nocompile.extern_06;
+
+// missing extern(C) modifier
+
+extern(C) void *wglGetProcAddress(char*);
+extern(C) int function() glFunctionFoo;
+  
+static this() {
+   glFunctionFoo = cast(int function()) wglGetProcAddress("glFunctionFoo");
+}
+
+