[no bug]Can not retrieve the executable path from system

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
mnunesvsc
Posts: 22
Joined: Sun May 28, 2006 9:04 pm
Contact:

[no bug]Can not retrieve the executable path from system

Post by mnunesvsc »

Trying an old code to retrieve info from the system with:

Code: Select all

 
 appPath.assign( device->getFileSystem()->getWorkingDirectory().c_str() )
 
it fails on this function:

Code: Select all

 
        //! finds last occurrence of character in string
        /** \param c: Character to search for.
        \param start: start to search reverse ( default = -1, on end )
        \return Position where the character has been found,
        or -1 if not found. */
        s32 findLast(T c, s32 start = -1) const
        {
                start = core::clamp ( start < 0 ? (s32)(used) - 1 : start, 0, (s32)(used) - 1 );
                for (s32 i=start; i>=0; --i)
                        if (array[i] == c)
                                return i;
 
                return -1;
        }
 
On:

irrlicht SVN 3972
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Can not retrieve the executable path from system

Post by hybrid »

As a good rule of thumb: If it's a so basic function, it's more likely to be a problem on your side. I'd guess that you re-used some object code with a completely wrong class layout inside. Hence it also points you to a never used function. Just recompile everything and it should work
mnunesvsc
Posts: 22
Joined: Sun May 28, 2006 9:04 pm
Contact:

Re: Can not retrieve the executable path from system

Post by mnunesvsc »

it worked until friday ( 2011/10/21 ) after an svn update it do not work anymore.

AND i recompiled everything including the irrlicht engine.

Using MingW and static irrlicht.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Can not retrieve the executable path from system

Post by hybrid »

Yeah, I added a few methods to IFileSystem and CFileSystem. So the internal layout changed and different methods with wrongly set parameters are now called. So, just make sure you do a complete clean and recompile. Will definitely work.
mnunesvsc
Posts: 22
Joined: Sun May 28, 2006 9:04 pm
Contact:

Re: Can not retrieve the executable path from system

Post by mnunesvsc »

Well, cleaned the project and the irrlicht code, rebuilded everything, the version remaining the same, SVN 3972 the function does not work and the error presents on this piece of code:

Code: Select all

 
 
// this code belongs to 
// irrstring.h
 
        //! Returns character string
        /** \return pointer to C-style NUL terminated string. */
        const T* c_str() const
        {
                return array;
        }
 
 

here the an example of code to reproduce the error:

Code: Select all

 
std::string appPath;
 appPath.assign( device->getFileSystem()->getWorkingDirectory().c_str() );
 
it generate an sigsegv and crashed the app, to my application, i just dont use it anymore, so reporting as an bug.

just for note, i am doing the compilation of the code with:
irrlicht static on
mingw 4.5.2 on
an windows 7 x64
using codeblocks

Thanks for your time.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Can not retrieve the executable path from system

Post by hybrid »

Well, I tested the code as well, and did not get any problem. And maybe you can understand that a simple "return array" can not crash. If array is NULL, it returns NULL. If there is no class containing the array, you cannot call any method on it anyway. It's simply not possible to make the app crash here. Maybe you include from an old include directory, or vice versa use old code with new headers. Or you write over some array bounds, overwriting your app code in memory. Or something else. But it's definitely and for very sure no problem in Irrlicht.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Can not retrieve the executable path from system

Post by CuteAlien »

Please try to reproduce it in a complete short example. A simple main-function which you can compile. Most often while trying to simplify the conditions in which you can reproduce the problem you will find the real problem.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
mnunesvsc
Posts: 22
Joined: Sun May 28, 2006 9:04 pm
Contact:

Re: Can not retrieve the executable path from system

Post by mnunesvsc »

Here follows, simple app reproducing the error using, as said before, the following configurations

mingw 4.5.2
codeblocks
on Windows 7 x64
irrlicht statically linked

Code: Select all

 
#include <iostream>
#include <irrlicht.h>
 
std::string appPath;
irr::IrrlichtDevice *device = NULL;
 
//
int main()
{
    //
    device = irr::createDevice( irr::video::EDT_SOFTWARE, irr::core::dimension2d<irr::u32>(640, 480), 32, false, true, false, 0);
 
    //
    appPath.assign( device->getFileSystem()->getWorkingDirectory().c_str() );
 
    //
    std::cout << "Hello world!" << std::endl;
 
    //
    std::cout << "Path!" << appPath.c_str() << std::endl;
 
    //
    return 0;
}
 
I will swear to debug in the future, but right now i am really out of time.

thanks for your time.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Can not retrieve the executable path from system

Post by serengeor »

mnunesvsc wrote:Here follows, simple app reproducing the error using, as said before, the following configurations
Works fine for me :?
win7 32bit
svn rev 3957
gcc 4.5.2
static linking
Working on game: Marrbles (Currently stopped).
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Can not retrieve the executable path from system

Post by CuteAlien »

Maybe it still finds an old dll? I think the linker prefers that if both are available. Note that unlike the static library which is in lib/Win32-gcc it can be found in bin/Win32-gcc. So if you got a dll there, delete or rename it and try linking again (also make sure you set _IRR_STATIC_LIB in the library (c::b project file does that for you) as well as in your example (you have to do it there yourself) when compiling static!, but you'll get linker-errors otherwise anyway).

edit: Btw, I tried it with Win7, 64-bit system on c::b, but not static and it worked as expected.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
mnunesvsc
Posts: 22
Joined: Sun May 28, 2006 9:04 pm
Contact:

Re: Can not retrieve the executable path from system

Post by mnunesvsc »

Thank all of you for the really fast response, i switched to the release version of compilation and Voilà it worked i think it is something on the generation of the debug version wich one i had renamed to irrlicht_d.a, then i had used the release version of the lib on the compilation ( of the debug ) and worked again so the only difference is the lib

on the same code, using the same conditions ( windows 7.. bla bla )

irrlicht.a ( works )
irrlicht_d.a ( do not work )

thank you very much for the responses.
Post Reply