Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 9778 - Support passing resource files to DMD. #52

Merged
1 commit merged into from Mar 21, 2013
Merged

Issue 9778 - Support passing resource files to DMD. #52

1 commit merged into from Mar 21, 2013

Conversation

ghost
Copy link

@ghost ghost commented Mar 21, 2013

http://d.puremagic.com/issues/show_bug.cgi?id=9778

Note that other compilers like GDC expect the resource file to be compiled to an object file via windres, so .res files are likely only supported by DMD (does LDC support them or does it expect object files too?).

@CyberShadow
Copy link
Member

Rather than adding an artificial restriction to rdmd, I think it would be better to allow people to add .res support to the ldmd and gdmd wrappers.

Restricting a feature to one known compiler is akin to the old "This website requires Internet Explorer" checks.

@ghost
Copy link
Author

ghost commented Mar 21, 2013

I think once the resource file is compiled to .res it's (almost) too late. windres works on .rc scripts, compiles them to .o and this can then be fed into GCC/GDC/etc. DMD expects the .rc file to be compiled with DM's rcc or VS's rc compiler.

But I've just read that windres can convert .res files link:
windres -i myres.res -o myres.o

So what should we do? I'm thinking either make RDMD try to call windres to convert the file when the compiler isn't DMD, or maybe we should try to wrap the .res argument into another switch that is fed to the compiler script (e.g resource.res -> gdmd -resource=resource.res, so the script can deal with the .res file)?

@CyberShadow
Copy link
Member

rdmd shouldn't do anything.

The way things work now is that dmd defines an interface (via the list of command-line arguments it supports), and other compiler vendors provide wrappers (gdmd -> gdc, and ldmd -> ldc) which translate that interface to the switches customary to that compiler tool chain.

If we add things related to the compiler, we will no longer have such a defined interface. Build tools other than rdmd would need to reimplement the same behavior. Therefore, I think the behavior should be implemented in ldmd or gdmd, not rdmd.

@ghost
Copy link
Author

ghost commented Mar 21, 2013

But there is no switch for resources in DMD. So what should we do, just pass the .res file to any compiler?

@CyberShadow
Copy link
Member

Yes. There is already a convention of doing different things depending on the file extension (e.g. .d / .obj / .lib).

@ghost
Copy link
Author

ghost commented Mar 21, 2013

Ok, then the change is much simpler. Updated.

@ghost
Copy link
Author

ghost commented Mar 21, 2013

Well I'll just pull this, it's not controversial.

ghost pushed a commit that referenced this pull request Mar 21, 2013
Issue 9778 - Support passing resource files to DMD.
@ghost ghost merged commit bdabcae into dlang:master Mar 21, 2013
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants