Export values (enum, int, char[]...) for DLL

Nrgyzer nrgyzer at gmail.com
Wed May 5 11:03:11 PDT 2010


Ary Borenszweig Wrote:

> Nrgyzer wrote:
> > Hello everybody,
> > 
> > I'm trying to create a (very) simple DLL by using D. Now I want export values - is there any way do this... for example:
> > 
> > Example:
> > 
> > mydll.d:
> > export int i;
> > 
> > mydll2.d:
> > export int i = 99;
> > 
> > dll.d:
> > // Copied from http://www.digitalmars.com/d/2.0/dll.html
> > 
> > test.d:
> > import std.stdio;
> > import mydll;
> > 
> > void main() {
> >    writefln(mydll.i);
> > }
> > 
> > -> The problem is (same problem for float, enum... , that I always get 0 by calling mydll.i instead of 99.
> > I hope anyone can help me, please :)
> > 
> > Thanks for help in advance :)
> 
> I don't know much about dlls, but aren't you accessing mydll.i, which is 
> 0, instead of mydll2.i, which is 99?

By using mydll2.i instead of mydll.i I didn't need a dll because the value (in this case i) is defined in my compiled exe file (because mydll2.d will be imported by compiling). So I can simply replace the dll but this has no effect to my exe file (because i is defined in the exe)..... - I think :-D


More information about the Digitalmars-d-learn mailing list