digitalmars.D.learn - tyro[a.c.edwards]
- How to access externally defined varibles and functions? (28/28) Jan 20 2006 What is the correct way to access externally defined variables and funct...
- Jarrett Billingsley (22/22) Jan 20 2006 "How to access externally defined varibles and functions?"
- tyro[a.c.edwards] (7/29) Jan 20 2006 Yes! I'm trying to access "global" from test.d with "func()". This solut...
- Chris Sauls (25/26) Jan 20 2006 Simple:
What is the correct way to access externally defined variables and functions? The following attempt result in a linker error. Thanks, Andrew --------- test.d ---------- import std.cstream; import std.process; int global; extern (D) void func(); void main() { global = 12; dout.writefln(global); func(); dout.writefln(global); } --------- test2.d ---------- extern (D) int globe; void func() { globe = 47; } --------- result ---------- F:\did>dmd test test2 c:\dmd\bin\..\..\dm\bin\link.exe test+test2,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved test.obj(test) Error 42: Symbol Undefined _D4test4funcFZv --- errorlevel 1
Jan 20 2006
"How to access externally defined varibles and functions?" <How_member pathlink.com> wrote in message news:dqrcnd$2n3s$1 digitaldaemon.com... --------- test.d ---------- import std.cstream; import std.process; int global; void main() { global = 12; dout.writefln(global); func(); dout.writefln(global); } --------- test2.d ---------- int globe; void func() { globe = 47; } ---------------------------- And are you trying to change "global" with "func()"?
Jan 20 2006
In article <dqrdqj$2o13$1 digitaldaemon.com>, Jarrett Billingsley says..."How to access externally defined varibles and functions?" <How_member pathlink.com> wrote in message news:dqrcnd$2n3s$1 digitaldaemon.com... --------- test.d ---------- import std.cstream; import std.process; int global; void main() { global = 12; dout.writefln(global); func(); dout.writefln(global); } --------- test2.d ---------- int globe; void func() { globe = 47; } ---------------------------- And are you trying to change "global" with "func()"?Yes! I'm trying to access "global" from test.d with "func()". This solution doesn't really work for me. Basically, I have had the pleasure of using externally defined C functions and variables and would like to understand why they work and how to use that facility in D. Thanks again, Andrew
Jan 20 2006
What is the correct way to access externally defined variables and functions?Simple: -- Chris Sauls
Jan 20 2006