October 13, 2012
On Saturday, 13 October 2012 at 11:07:36 UTC, Jacob Carlborg wrote:
> If you specify the path where the compiler should find import files in a source file, how should the compiler handle that?

Source code does not depend on an import path, that is an environment issue. Thus you would not specify import paths in source files.

>> I've
>> realized that the dependency on a library only makes sense for header
>> files, and header files only make sense when interfacing with C.
>> Dependency on D code and libraries all come stated from the 'import'
>> statement.
>
> Ok, I really don't understand this last section.

    module bob;
    extern(C) void fishingBob();

This function has no definition, code importing bob is not getting fishingBob.

    module joe;
    void runningJoe() { ... }

The code importing joe does get runningJoe. So while I think this change makes sense:

    module bob;
    pragma(lib, "bob.lib");
    extern(C) void fishingBob();

This one does not:

    module joe;
    pragma(lib, "joe.lib");
    void runningJoe() { ... }

Or

    import tango.Text;
    pragma(lib, "tango.lib"); ...
October 14, 2012
On 2012-10-13 23:11, Jesse Phillips wrote:

> Source code does not depend on an import path, that is an environment
> issue. Thus you would not specify import paths in source files.

You need to specify it somewhere. Why would I want half of the compiler flags in one place and the other half in another place? And why should I need to specify it in the first place, when the built tool can do that with the help of the package manager.


>      module bob;
>      extern(C) void fishingBob();
>
> This function has no definition, code importing bob is not getting
> fishingBob.
>
>      module joe;
>      void runningJoe() { ... }
>
> The code importing joe does get runningJoe. So while I think this change
> makes sense:
>
>      module bob;
>      pragma(lib, "bob.lib");
>      extern(C) void fishingBob();
>
> This one does not:
>
>      module joe;
>      pragma(lib, "joe.lib");
>      void runningJoe() { ... }
>
> Or
>
>      import tango.Text;
>      pragma(lib, "tango.lib"); ...

Sure that's not point if you building from source. But if you pre-compile a library and have import files (.di) then pragma(lib) would make sense, but it doesn't currently work with import files anyway.

-- 
/Jacob Carlborg
1 2 3 4 5 6 7 8 9
Next ›   Last »