View previous topic :: View next topic |
Author |
Message |
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Fri Mar 25, 2005 8:59 pm Post subject: Building DLL's |
|
|
Derek, I have to say: this is a great tool. As of last week, I deleted my make files and batch scripts and haven't looked back.
I hit a snag with trying to coerce Build to create a dll. The program outputs an .exe file, which has to be renamed to a .dll file to work.
I've tried to use the '-of' option, with no luck. Apparently, "-of" is being overridden in the .rsp file, which explains why the output is always an .exe file.
Also, 'pragma(target,"foobar.dll");' doesn't do the job either. I'm not sure what I'm missing here.
Thanks, _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Sat Mar 26, 2005 12:43 am Post subject: Re: Building DLL's |
|
|
pragma wrote: | Derek, I have to say: this is a great tool. As of last week, I deleted my make files and batch scripts and haven't looked back.
I hit a snag with trying to coerce Build to create a dll. The program outputs an .exe file, which has to be renamed to a .dll file to work.
I've tried to use the '-of' option, with no luck. Apparently, "-of" is being overridden in the .rsp file, which explains why the output is always an .exe file.
Also, 'pragma(target,"foobar.dll");' doesn't do the job either. I'm not sure what I'm missing here.
Thanks, |
Yep, DLL creation was on my list of things to do, so I guess its about time I did it
Give me few hours, okay ...? _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Sat Mar 26, 2005 12:34 pm Post subject: |
|
|
This is proving to be a bit more difficult than first thought.
I can get the DLL built, but I can't seem to be able to access the routines within it. Are you using the 'implib' method or the 'exports' method? _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Sun Mar 27, 2005 8:21 pm Post subject: |
|
|
Derek Parnell wrote: | This is proving to be a bit more difficult than first thought.
I can get the DLL built, but I can't seem to be able to access the routines within it. Are you using the 'implib' method or the 'exports' method? |
I'm using the 'exports' method with a Build-generated build file.
Code: |
version(build){
version(DigitalMars) version(build){
pragma(build_def,"
LIBRARY 'My Library'
DESCRIPTION 'D Library'
EXETYPE NT
SUBSYSTEM WINDOWS
CODE PRELOAD DISCARDABLE
DATA PRELOAD SINGLE
");
}
}
extern(C) export myfunction(){}
|
I'm not enumerating the exports via "build_def", since DMD is nice enough to handle all that for me. also, I'm making sure to use extern(C) to avoid name-mangling issues:
Code: |
extern(C) export void foo(){} // exports "foo"
export void bar(){} // exports "D5mydll3barFZv"
|
... makes life much easier. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Mon Mar 28, 2005 5:32 am Post subject: |
|
|
V1.16 now has DLL support. Let me know how it goes as it works here with a simple example but I haven't tested it extensively. _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Tue Mar 29, 2005 9:32 pm Post subject: |
|
|
Derek Parnell wrote: | V1.16 now has DLL support. Let me know how it goes as it works here with a simple example but I haven't tested it extensively. |
I'm now using V1.17 and it works great for building .dll files. It did it quite automatically, w/o any real prompting that I wanted one (it's almost creepy).
The only gotcha is with the build_def pragma. If I have a "LIBRARY" line added to the .def file, optlink complains that it's already there.
Code: | pragma(build_def,"LIBRARY 'mylibrary.dll'"); // optlink whines if this is present |
Also, using pragma(target,"mylibrary.dll"); works as expected as does -T. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Tue Mar 29, 2005 10:46 pm Post subject: |
|
|
pragma wrote: | The only gotcha is with the build_def pragma. If I have a "LIBRARY" line added to the .def file, optlink complains that it's already there.
Code: | pragma(build_def,"LIBRARY 'mylibrary.dll'"); // optlink whines if this is present |
|
Is Build creating the .DEF file with two LIBRARY entries?
I thought I had coded it so that only one would be in the file. One possibility could be that the word 'LIBRARY' is spelled with different cases. I don't (yet) do a case insensitive compare of elements already included in the definition file. _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
|