Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
February 09, 2004 templating question | ||||
---|---|---|---|---|
| ||||
How do I take a template I have written and tested and make it available to programs I write without including the .d file in the new program compile? Or...how to I make a library out of one or more template files for use in the D environment? In linux, I'd try ar, but in win32 I have no clue... |
February 10, 2004 Re: templating question | ||||
---|---|---|---|---|
| ||||
Posted in reply to larry cowan Attachments: | larry cowan wrote: > How do I take a template I have written and tested and make it available to programs I write without including the .d file in the new program compile? Or...how to I make a library out of one or more template files for use in the D environment? In linux, I'd try ar, but in win32 I have no clue... > > I attached a working example (for Windows). I'm not sure if it answers your question, but maybe it'll point you in the right direction. -- Justin http://jcc_7.tripod.com/d/ |
February 10, 2004 Re: templating question | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | This works, but is not what I meant. What is the utility, D or otherwise to make a .lib? I have tried calling the module with and without a module beginning and putting the compiled object in the SRC\MYLIBS directory (calling the module mylibs.mytemplate), without success, so I'm guessing I need a .lib. Is a compiled "template module" a full fledged .obj module? Is it accessible if in the path without a specific call into the link? If coded as a module and the d file is in the src\mylibs directory, the compile finds what is needed in the d, but the link fails, not finding the .obj pieces (several any-type functions). Doesn't work any better if .d and .obj are in the local (.) directory either. Where can I go from here? Dave seems to use an APROPOS directory in SRC, but the things I have seen here are just .d code without any further info. If there is not something D-based for creating libs, I might try to create something, but I need to know more about D objects, and whether D & C coded objects could/should be mixed, etc. -larry In article <c0975a$1lt0$1@digitaldaemon.com>, J C Calvarese says... > >This is a multi-part message in MIME format. >--------------000707000104010205010507 >Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit > >larry cowan wrote: >> How do I take a template I have written and tested and make it available to programs I write without including the .d file in the new program compile? Or...how to I make a library out of one or more template files for use in the D environment? In linux, I'd try ar, but in win32 I have no clue... >> >> > >I attached a working example (for Windows). I'm not sure if it answers your question, but maybe it'll point you in the right direction. > >-- >Justin >http://jcc_7.tripod.com/d/ > > name="max_temp.bat" = compiles each to .obj, links together as executable > > name="max_temp.d" = coded template as module > > name="main.d" = coded main() with use of template |
February 10, 2004 Re: templating question | ||||
---|---|---|---|---|
| ||||
Posted in reply to larry cowan | Now I found "dm\lib.exe" with a -h option. I'll see what I can do with this and probably work out my problem - just haven't done much in Win before beyond porting some C/C++ code from Unix. Walter's explanation of his lib prog on the website has told me the basics (www.digitalmars.com/ctg/lib.html). Sorry to have thrown out the question before doing enough homework first, but maybe someone else will have been helped... -larry In article <c0anvl$148p$1@digitaldaemon.com>, larry cowan says... > >This works, but is not what I meant. What is the utility, D or otherwise to make a .lib? I have tried calling the module with and without a module beginning and putting the compiled object in the SRC\MYLIBS directory (calling the module mylibs.mytemplate), without success, so I'm guessing I need a .lib. > >Is a compiled "template module" a full fledged .obj module? Is it accessible if in the path without a specific call into the link? If coded as a module and the d file is in the src\mylibs directory, the compile finds what is needed in the d, but the link fails, not finding the .obj pieces (several any-type functions). Doesn't work any better if .d and .obj are in the local (.) directory either. Where can I go from here? > >Dave seems to use an APROPOS directory in SRC, but the things I have seen here are just .d code without any further info. If there is not something D-based for creating libs, I might try to create something, but I need to know more about D objects, and whether D & C coded objects could/should be mixed, etc. > >-larry > >In article <c0975a$1lt0$1@digitaldaemon.com>, J C Calvarese says... >> >>This is a multi-part message in MIME format. >>--------------000707000104010205010507 >>Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit >> >>larry cowan wrote: >>> How do I take a template I have written and tested and make it available to programs I write without including the .d file in the new program compile? Or...how to I make a library out of one or more template files for use in the D environment? In linux, I'd try ar, but in win32 I have no clue... >>> >>> >> >>I attached a working example (for Windows). I'm not sure if it answers your question, but maybe it'll point you in the right direction. >> >>-- >>Justin >>http://jcc_7.tripod.com/d/ >> >> name="max_temp.bat" = compiles each to .obj, links together as executable >> >> name="max_temp.d" = coded template as module >> >> name="main.d" = coded main() with use of template > > |
February 11, 2004 Re: templating question | ||||
---|---|---|---|---|
| ||||
Posted in reply to larry cowan | larry cowan wrote: > Now I found "dm\lib.exe" with a -h option. I'll see what I can do with this and > probably work out my problem - just haven't done much in Win before beyond > porting some C/C++ code from Unix. Walter's explanation of his lib prog on the > website has told me the basics (www.digitalmars.com/ctg/lib.html). Sorry to > have thrown out the question before doing enough homework first, but maybe > someone else will have been helped... You asked a good question. I don't remember how I figured out how to make a .lib file. Maybe it was from someone else asking here how they're created. If I knew Linux better (I'm sure my Linux skills are worse than your Windows skills...), I probably would have figured out what you were after and suggested this for a batch file right away: @echo off echo Compile Template (create .obj)... dmd max_temp.d -c echo. echo Creating .lib... lib -c max_temp.lib max_temp.obj echo. echo Compile and Link Main File... dmd main.d max_temp.lib echo. echo Running example... main.exe pause erase main.obj erase main.map erase max_temp.obj erase max_temp.lib > Dave seems to use an APROPOS directory in SRC, but the things I have > seen here are just .d code without any further info. If there is not > something D-based for creating libs, I might try to create something, > but I need to know more about D objects, and whether D & C coded > objects could/should be mixed, etc. By the way, I don't think I'm familiar with Dave's work. Is his APROPOS available for download somewhere? > > -larry -- Justin http://jcc_7.tripod.com/d/ |
February 11, 2004 Re: templating question | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | The writer's name may be wrong, but I have picked up some stuff with module names prefixed by "atropos." - I think out of the forum. I have figured out the lib creation stuf and played with module names and .d file and .lib positioning. I can get the .d info picked up by the compiler directly, by placing it in the src\phobos hierarchy with appropriate module naming. What I haven't been able to do is to get the linker to pick up the .lib or .obj tags without specific inclusion of the .lib, .obj, or .d file in the compile and link. Presume that dmd\bin\sc.ini, dmd\bin\dmd.conf, or dm\bin\sc.ini modification is required, but I haven't been able to discover how yet. -larry "J C Calvarese" <jcc7@cox.net> wrote in message news:c0brjp$2v47$1@digitaldaemon.com... > larry cowan wrote: > > Now I found "dm\lib.exe" with a -h option. I'll see what I can do with this and > > probably work out my problem - just haven't done much in Win before beyond > > porting some C/C++ code from Unix. Walter's explanation of his lib prog on the > > website has told me the basics (www.digitalmars.com/ctg/lib.html). Sorry to > > have thrown out the question before doing enough homework first, but maybe > > someone else will have been helped... > > You asked a good question. I don't remember how I figured out how to make a .lib file. Maybe it was from someone else asking here how they're created. > > If I knew Linux better (I'm sure my Linux skills are worse than your Windows skills...), I probably would have figured out what you were after and suggested this for a batch file right away: > > @echo off > echo Compile Template (create .obj)... > dmd max_temp.d -c > echo. > echo Creating .lib... > lib -c max_temp.lib max_temp.obj > echo. > echo Compile and Link Main File... > dmd main.d max_temp.lib > echo. > echo Running example... > main.exe > pause > erase main.obj > erase main.map > erase max_temp.obj > erase max_temp.lib > > > > Dave seems to use an APROPOS directory in SRC, but the things I have > > seen here are just .d code without any further info. If there is > not > something D-based for creating libs, I might try to create > something, > but I need to know more about D objects, and whether D & C > coded > objects could/should be mixed, etc. > > By the way, I don't think I'm familiar with Dave's work. Is his APROPOS available for download somewhere? > > > > > -larry > > -- > Justin > http://jcc_7.tripod.com/d/ |
February 11, 2004 Re: templating question | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | J C Calvarese wrote: > larry cowan wrote: > >> Now I found "dm\lib.exe" with a -h option. I'll see what I can do with this and >> probably work out my problem - just haven't done much in Win before beyond >> porting some C/C++ code from Unix. Walter's explanation of his lib prog on the >> website has told me the basics (www.digitalmars.com/ctg/lib.html). Sorry to >> have thrown out the question before doing enough homework first, but maybe >> someone else will have been helped... > > > You asked a good question. I don't remember how I figured out how to make a .lib file. Maybe it was from someone else asking here how they're created. > > If I knew Linux better (I'm sure my Linux skills are worse than your Windows skills...), I probably would have figured out what you were after and suggested this for a batch file right away: > > @echo off > echo Compile Template (create .obj)... > dmd max_temp.d -c > echo. > echo Creating .lib... > lib -c max_temp.lib max_temp.obj > echo. > echo Compile and Link Main File... > dmd main.d max_temp.lib > echo. > echo Running example... > main.exe > pause > erase main.obj > erase main.map > erase max_temp.obj > erase max_temp.lib > > > > Dave seems to use an APROPOS directory in SRC, but the things I have > seen here are just .d code without any further info. If there is not > something D-based for creating libs, I might try to create something, > but I need to know more about D objects, and whether D & C coded > objects could/should be mixed, etc. > > By the way, I don't think I'm familiar with Dave's work. Is his APROPOS available for download somewhere? Apropos is a little lib I coded, actually. It's basically a collection of miscellany that I've found to be frequently useful: <http://ikagames.com/andy/d> .lib files are basically just .zip without compression. You make a bunch of object files with dmd, then use the lib tool to mash them together. lib -c thingie.lib a.obj b.obj c.obj ..... As for templates, I've frequently had link errors with templates that are defined in .libs. Including the source file that defines the template into the build scrypt solves the problem. I suspect this is because D templates have to belong to some obj somewhere, and they have to be compiled only once for each set of arguments. -- andy |
February 12, 2004 Re: templating question | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | Andy Friesen wrote: > J C Calvarese wrote: [...] >> By the way, I don't think I'm familiar with Dave's work. Is his APROPOS available for download somewhere? > > > Apropos is a little lib I coded, actually. It's basically a collection of miscellany that I've found to be frequently useful: <http://ikagames.com/andy/d> Thanks for pointing me in the right direction. It looks like you've done some neat things with templates. Apropos didn't sound familiar to me. (If he'd mentioned dfbth, on the other hand, I would've known to go to your website.) -- Justin http://jcc_7.tripod.com/d/ |
Copyright © 1999-2021 by the D Language Foundation