Thread overview |
---|
April 05, 2014 Some issues (bugs?) with generated header files | ||||
---|---|---|---|---|
| ||||
Hi, i want to generate header (di) files for a library I developed and faced some issues. The project structure is: source -wba --com ---defintions.d ---... --dispatcher.d --... --package.d MonoDevelop generated following statement for me: C:\D\dmd2\windows\bin\dmd.exe -debug -gc "source\wba\com\definitions.d" "source\wba\com\docHostUIHandler.d" "source\wba\com\oleClientSite.d" "source\wba\com\oleInPlaceFrame.d" "source\wba\com\oleInPlaceSite.d" "source\wba\com\storage.d" "source\wba\com\webBrowserEvents2.d" "source\wba\dispatcher.d" "source\wba\main.d" "source\wba\objectForScripting.d" "source\wba\package.d" "source\wba\wbWrapper.d" "source\wba\webbrowser.d" "source\wba\webBrowserForm.d" "-IC:\D\dmd2\src\druntime\import" "-IC:\D\dmd2\src\phobos" "-IC:\D\lib\WindowsAPI" -lib "-odobj\Header" "-ofJ:\Workspace\Libraries\WebBrowserApplication\bin\Header\wba.lib" -H 3 issues: 1) While using the header files in another project, the package.di file does not work as expected. I cannot use statement: import wba; main.d(3): Error: module wba is in file 'wba.d' which cannot be read It only works if I rename package.di to package.d 2) property methods doesn't work with header files. For this coding: @property docHostUIHandler() { return this._docHostUIHandler; } This di coding was created: @property docHostUIHandler(); While using in another project these errors are raised for the line in the di coding: Error: function declaration without return type. (Note that constructors are always named 'this') Error: no identifier for declarator docHostUIHandler() 3) How can I specify the output folder for the di files and also specify that the same folder structure is used as described above (wba, wba/com) Kind regards André |
April 05, 2014 Re: Some issues (bugs?) with generated header files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andre | On Saturday, 5 April 2014 at 10:00:13 UTC, Andre wrote:
> Hi,
>
> i want to generate header (di) files for a library I developed
> and faced some issues.
> The project structure is:
> source
> -wba
> --com
> ---defintions.d
> ---...
> --dispatcher.d
> --...
> --package.d
>
>
> MonoDevelop generated following statement for me:
> C:\D\dmd2\windows\bin\dmd.exe -debug -gc "source\wba\com\definitions.d" "source\wba\com\docHostUIHandler.d" "source\wba\com\oleClientSite.d" "source\wba\com\oleInPlaceFrame.d" "source\wba\com\oleInPlaceSite.d" "source\wba\com\storage.d" "source\wba\com\webBrowserEvents2.d" "source\wba\dispatcher.d" "source\wba\main.d" "source\wba\objectForScripting.d" "source\wba\package.d" "source\wba\wbWrapper.d" "source\wba\webbrowser.d" "source\wba\webBrowserForm.d" "-IC:\D\dmd2\src\druntime\import" "-IC:\D\dmd2\src\phobos" "-IC:\D\lib\WindowsAPI" -lib "-odobj\Header" "-ofJ:\Workspace\Libraries\WebBrowserApplication\bin\Header\wba.lib" -H
>
> 3 issues:
>
> 1) While using the header files in another project, the package.di file does not work as expected. I cannot use statement: import wba;
>
> main.d(3): Error: module wba is in file 'wba.d' which cannot be read
> It only works if I rename package.di to package.d
>
>
> 2) property methods doesn't work with header files.
> For this coding:
> @property docHostUIHandler()
> {
> return this._docHostUIHandler;
> }
> This di coding was created:
> @property docHostUIHandler();
>
> While using in another project these errors are raised for
> the line in the di coding:
>
> Error: function declaration without return type. (Note that constructors are always named 'this')
> Error: no identifier for declarator docHostUIHandler()
>
>
> 3) How can I specify the output folder for the di files
> and also specify that the same folder structure is used as
> described above (wba, wba/com)
>
> Kind regards
> André
i have little info about this, but let me clear something for you.
- interface generation is outdated/broken
- .di files should be avoided now, this is why import looking for .d only, but idk why.
- to avoid @property issue you can try adding export specifier("export @property someProperty()")
-Hd flag allows specify header location, -Hf specify name for example if you want to write them to directory named "imports" you call "dmd myfile.d -Hdimports" which save myfile.d to imports/myfile.di
|
April 05, 2014 Re: Some issues (bugs?) with generated header files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andre | On Saturday, 5 April 2014 at 10:00:13 UTC, Andre wrote:
>
> 2) property methods doesn't work with header files.
> For this coding:
> @property docHostUIHandler()
> {
> return this._docHostUIHandler;
> }
> This di coding was created:
> @property docHostUIHandler();
>
the problem with this that your code doesnt specify neither auto nor other return type.
// not recommended, actual type unknown to users
@property auto docHostUIHandler()
{
return this._docHostUIHandler;
}
// recommended, manual type
@property HostUIHandlerType()
{
return this._docHostUIHandler;
}
p.s. language reference recommends also put underscore at end instead front, prepending underscore may be used by compiler generated stuff resulting in name clashes.
|
April 05, 2014 Re: Some issues (bugs?) with generated header files | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat | Am 05.04.2014 12:49, schrieb evilrat:
> i have little info about this, but let me clear something for you.
>
> - interface generation is outdated/broken
> - .di files should be avoided now, this is why import looking for .d
> only, but idk why.
> - to avoid @property issue you can try adding export specifier("export
> @property someProperty()")
>
> -Hd flag allows specify header location, -Hf specify name for example if
> you want to write them to directory named "imports" you call "dmd
> myfile.d -Hdimports" which save myfile.d to imports/myfile.di
Thanks a lot for clarification.
Kind regards
André
|
April 05, 2014 Re: Some issues (bugs?) with generated header files | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat | On Saturday, 5 April 2014 at 10:55:19 UTC, evilrat wrote:
> // recommended, manual type
> @property HostUIHandlerType()
> {
> return this._docHostUIHandler;
> }
oops. this of course should be like normal function.
|
Copyright © 1999-2021 by the D Language Foundation