Embarcadero/Borland

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
WWebber
Posts: 16
Joined: Sun Feb 26, 2012 11:24 am

Embarcadero/Borland

Post by WWebber »

Since I saw some older messages, I successfully run IrrLicht with Embarcadero/Borland!

BTW: 3dsmax import (with the help of 3dsmax-sdk-help) works also perfect.

Image

Just some small changes to compile the IrrLicht.DLL:

define
IRRLICHT_EXPORTS
for compiler.

IrrCompileConfig.h:

Code: Select all

...
#ifdef __BORLANDC__
  #define sqrtf(x) ((float)sqrt(x))
#endif
...
//Removed dx8:
#undef _IRR_COMPILE_WITH_DIRECT3D_8_
...
 
irrmath.h

Code: Select all

//defined in IrrCompileConfig.h!
#ifdef sqrtf
  #undef sqrtf
#endif
 
CFileSystem.cpp:

Code: Select all

 
//! Creates a list of files and directories in the current working directory
IFileList* CFileSystem::createFileList()
{
        CFileList* r = 0;
        io::path Path = getWorkingDirectory();
        Path.replace('\\', '/');
        if (Path.lastChar() != '/')
                Path.append('/');
 
        //! Construct from native filesystem
        if (FileSystemType == FILESYSTEM_NATIVE)
        {
                // --------------------------------------------
                //! Windows version
                #ifdef _IRR_WINDOWS_API_
                #if !defined ( _WIN32_WCE )
 
                r = new CFileList(Path, true, false);
 
//BIRDIE
#ifndef __BORLANDC__
                struct _tfinddata_t c_file;
                long hFile;
 
                if( (hFile = _tfindfirst( _T("*"), &c_file )) != -1L )
                {
                        do
                        {
                                r->addItem(Path + c_file.name, c_file.size, (_A_SUBDIR & c_file.attrib) != 0, 0);
                        }
                        while( _tfindnext( hFile, &c_file ) == 0 );
 
                        _findclose( hFile );
                }
#else
                struct ffblk c_file;
                long         hFile;
 
                if( (hFile = findfirst( _T("*"), &c_file, 0 )) != -1L )
                {
                        do
                        {
                                r->addItem(Path + c_file.ff_name, c_file.ff_fsize, (_A_SUBDIR & c_file.ff_attrib) != 0, 0);
                        }
                        while( findnext( &c_file ) == 0 );
 
                        findclose( &c_file );
                }
 
#endif
 
                #endif
 
                //TODO add drives
                //entry.Name = "E:\\";
                //entry.isDirectory = true;
                //Files.push_back(entry);
                #endif
 
                // --------------------------------------------
                //! Linux version
                #if (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
 
 
                r = new CFileList(Path, false, false);
 
                r->addItem(Path + "..", 0, true, 0);
 
                //! We use the POSIX compliant methods instead of scandir
                DIR* dirHandle=opendir(Path.c_str());
                if (dirHandle)
                {
                        struct dirent *dirEntry;
                        while ((dirEntry=readdir(dirHandle)))
                        {
                                u32 size = 0;
                                bool isDirectory = false;
 
                                if((strcmp(dirEntry->d_name, ".")==0) ||
                                   (strcmp(dirEntry->d_name, "..")==0))
                                {
                                        continue;
                                }
                                struct stat buf;
                                if (stat(dirEntry->d_name, &buf)==0)
                                {
                                        size = buf.st_size;
                                        isDirectory = S_ISDIR(buf.st_mode);
                                }
                                #if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__)
                                // only available on some systems
                                else
                                {
                                        isDirectory = dirEntry->d_type == DT_DIR;
                                }
                                #endif
 
                                r->addItem(Path + dirEntry->d_name, size, isDirectory, 0);
                        }
                        closedir(dirHandle);
                }
                #endif
        }
        else
        {
                //! create file list for the virtual filesystem
                r = new CFileList(Path, false, false);
 
                //! add relative navigation
                SFileListEntry e2;
                SFileListEntry e3;
 
                //! PWD
                r->addItem(Path + ".", 0, true, 0);
 
                //! parent
                r->addItem(Path + "..", 0, true, 0);
 
                //! merge archives
                for (u32 i=0; i < FileArchives.size(); ++i)
                {
                        const IFileList *merge = FileArchives[i]->getFileList();
 
                        for (u32 j=0; j < merge->getFileCount(); ++j)
                        {
                                if (core::isInSameDirectory(Path, merge->getFullFileName(j)) == 0)
                                {
                                        r->addItem(merge->getFullFileName(j), merge->getFileSize(j), merge->isDirectory(j), 0);
                                }
                        }
                }
        }
 
        if (r)
                r->sort();
        return r;
}
 
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Embarcadero/Borland

Post by hybrid »

Why do you define the sqrtf already in IrrCompileConfig? The proper way would be to include irrMath instead in the failing files. Could you please tell me where this problem occurs?
WWebber
Posts: 16
Joined: Sun Feb 26, 2012 11:24 am

Re: Embarcadero/Borland

Post by WWebber »

Hmm. AFAIR there were cases where irrmath.h was not included at all. I forgot if it had to do with DLL or the samples.
Weird, but I removed this define again and interestingly I can compile the DLL!? Maybe I have to investigate this again.
Post Reply