Re: dllobject/libobject

"Lars Ivar Igesund" <[email protected]>
Newsgroups gmane.comp.tools.aap.devel
Message-ID <025a01c37ed2$d2046080$0200000a@mesmer>
----- Original Message ----- 
From: "Bram Moolenaar" <[email protected]>
 
> A generic solution would be to tell ":dll" that it can use ordinary
> object files when "d" source files are used.  But how to do that from a
> "d" language module?  We probably have to do this by adding attributes
> to the object files, so that ":dll" can see that they are OK to use as
> dllobjtype.
> 
> I suppose key to this story is that src2obj() should be language
> specific.  For a D file it could add an attribute to the object file
> that says it can both be used with :program and :dll.  Thus instead of
> explicitly giving a different suffix argument to src2obj() it could be
> much smarter: recognize the filetype of the source and select the object
> suffix and other attributes based on that.
> 
> We should also have a "src2dllobj()" and "src2libobj()" then.  Or use an
> argument to specify "dllobject" or "libobject" (and "ltobject" I
> suppose).
> 
> Hmm, perhaps we should keep the simple and predictable src2obj()
> function and add a new one that is clever.  It would do something like
> this:
> 
> foreach item in source:
> # decide on the suffix to use
> if target == dllobject:
>     suffix = $DLLOBJSUF
> elif target == libobject:
>     suffix = $LIBOBJSUF
> elif target == ltobject:
>     suffix = $LTOBJSUF
>         else:
>     suffix = $OBJSUF
> 
> filetype = filetype_of(item)
> if exists("src2obj_" + filetype):
> # Special handling was defined for this filetype
> result = eval("src2obj_" _ filetype, suffix, args)
> else:
> # Use the default hanlding
> result = src2obj(item, suffix)

Ok, I feel that I need this stuff to work now. How and where
should I start? What needs to be added where? There seems
to be a lot of possible ways to do this and I don't think I'm in
a position to decide which. I can try to make an initial stab at it
when I know where to start :).

(And for reference; what I want to do, is to be able to compile
and build all types of D projects (at least dll, lib and program).
The posted dmodule.aap together with the tool/dmd.py fixes
most of this. The last problem is that the default linker needs
object files with the suffix .obj, not .sbj, .sh.obj or anything else,
just obj. Also keep in mind that there is no need to differentiate
the objectfiles when compiling D code for different targets.)

Lars Ivar Igesund



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.