Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: DSFML with DUB - object.Object.toString () is not callable using argument types  (Read 10855 times)

0 Members and 1 Guest are viewing this topic.

aldarion

  • Newbie
  • *
  • Posts: 1
    • View Profile
Hello,

I´m trying to use DFML with dub in a D Project. I have no DSFML related Code in my app.d, I have just added DSFML 2.1.0 to the dependencies in dub.json. If i use "dub build" I get the following Errors:
Performing "debug" build using dmd for x86.
dsfml:system 2.1.0: target for configuration "library" is up to date.
dsfml:audio 2.1.0: building configuration "library"...
C:\Users\me\AppData\Roaming\dub\packages\dsfml-2.1.0\src\dsfml\audio\soundbuffer.d(63,21): Error: function object.Object.toString () is not callable using argument types (const(char)*)
C:\Users\me\AppData\Roaming\dub\packages\dsfml-2.1.0\src\dsfml\audio\soundbuffer.d(148,22): Error: function object.Object.toString () is not callable using argument types (const(char)*)
C:\Users\me\AppData\Roaming\dub\packages\dsfml-2.1.0\src\dsfml\audio\soundbuffer.d(172,22): Error: function object.Object.toString () is not callable using argument types (const(char)*)
C:\Users\me\AppData\Roaming\dub\packages\dsfml-2.1.0\src\dsfml\audio\soundbuffer.d(196,22): Error: function object.Object.toString () is not callable using argument types (const(char)*)
C:\Users\me\AppData\Roaming\dub\packages\dsfml-2.1.0\src\dsfml\audio\soundbuffer.d(222,22): Error: function object.Object.toString () is not callable using argument types (const(char)*)
C:\Users\me\AppData\Roaming\dub\packages\dsfml-2.1.0\src\dsfml\audio\soundbuffer.d(247,22): Error: function object.Object.toString () is not callable using argument types (const(char)*)
C:\Users\me\AppData\Roaming\dub\packages\dsfml-2.1.0\src\dsfml\audio\soundrecorder.d(61,21): Error: function object.Object.toString () is not callable using argument types (const(char)*)
C:\Users\me\AppData\Roaming\dub\packages\dsfml-2.1.0\src\dsfml\audio\soundrecorder.d(92,21): Error: function object.Object.toString () is not callable using argument types (const(char)*)
C:\Users\me\AppData\Roaming\dub\packages\dsfml-2.1.0\src\dsfml\audio\soundstream.d(82,21): Error: function object.Object.toString () is not callable using argument types (const(char)*)
C:\Users\me\AppData\Roaming\dub\packages\dsfml-2.1.0\src\dsfml\audio\soundstream.d(278,21): Error: function object.Object.toString () is not callable using argument types (const(char)*)
dmd failed with exit code 1.
 

Those Errors seem to be caused by this code:
class SoundBuffer
{
        package sfSoundBuffer* sfPtr;

        this()
        {
                import dsfml.system.string;
                sfPtr = sfSoundBuffer_construct();
                err.write(toString(sfErr_getOutput())); //This is the excact error position.
        }
 
And similar snippets in other modules.
Which is imho related to this code in the module system.string.d:
immutable(T)[] toString(T)(in const(T)* str) pure
        if (is(T == dchar)||is(T == wchar)||is(T == char))
{
        return str[0..strlen(str)].idup;
}
 

I haven´t worked with templates in D yet, but to me it seems allright.
If I skip DSFML.Audio in the dub process, I get similar Errors in Graphics, Window and Network module.
I have tried to comment out the code to skip the "err.write", but some parts in the Network  and the Graphics Module are different, so I cant comment them out.


I´m using DUB 0.9.24 (newest) and DMD 2.071.0 (newest).
Thanks in advance.


Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
This is because of the newest D compiler. They fixed a few long standing bugs, but it ended up breaking the way the import system was doing some things. What was actually happening is that it was using Object.toString() instead of dsfml.system.string.toString() because the compiler will search locally for symbols before checking any imported packages, even packages imported in the same scope. You just need to make sure you're a little more explicit with your calls where there is an ambiguity of function names. 

I put the fixes in the code just a couple of minutes ago, so once dub updates its DSFML package you should be good to go.
DSFML - SFML for the D Programming Language.