Corrupted IrrINI-Project ... or somewhat like that.

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.
TomTim
Posts: 72
Joined: Mon Aug 16, 2010 5:32 pm
Location: NRW, Germany

Corrupted IrrINI-Project ... or somewhat like that.

Post by TomTim »

I got this problem: I wanna use IrrINI, but the ... well, programer set the default project configurations to a static library. Every time I compile the source code of IrrINI it just creates a LIB, although I need a DLL.

But I am no fool, I know how to change the settings. But now, unfortunaly, it just creates the DLL, and I am missing the usual LIB-file. What is this?
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Don't have access to the code right now but iirc the function createIniFile is not marked as an export. This is why you get a DLL without a library file.

Since this is just a small library I never thought anyone would actually want to have this as a DLL...

I'll take a look at this tonight.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
TomTim
Posts: 72
Joined: Mon Aug 16, 2010 5:32 pm
Location: NRW, Germany

Post by TomTim »

Sylence wrote:Don't have access to the code right now but iirc the function createIniFile is not marked as an export. This is why you get a DLL without a library file.

Since this is just a small library I never thought anyone would actually want to have this as a DLL...

I'll take a look at this tonight.
Libraries I have not written myself I ALWAYS store in DLLs ... that allows me to update the procedures without updating the exe (except for the case that the interface has changed).

However, how do I marked it as an export? Irrlicht does not seem to use __declspec(dllexport) ...
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

TomTim wrote:However, how do I marked it as an export? Irrlicht does not seem to use __declspec(dllexport) ...
Yes it does. IRRLICHT_API is defined as dllexport or dllimport.

Basically you have to add a define to the library's preprocessor defines (e.g. IRRINI_EXPORTS) and then you define something (e.g. IRRINI_API) as dllexport if the IRRINI_EXPORTS exists or as dllimport if it doesn't.

This way you will have exports if the classes are used from outside the library and imports if used from within.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
TomTim
Posts: 72
Joined: Mon Aug 16, 2010 5:32 pm
Location: NRW, Germany

Post by TomTim »

Sylence wrote:Yes it does. IRRLICHT_API is defined as dllexport or dllimport.

Basically you have to add a define to the library's preprocessor defines (e.g. IRRINI_EXPORTS) and then you define something (e.g. IRRINI_API) as dllexport if the IRRINI_EXPORTS exists or as dllimport if it doesn't.

This way you will have exports if the classes are used from outside the library and imports if used from within.
So why is no class marked with IRRINI_API?
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Because - as I've written above - I saw no sense in making the library a DLL...
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
TomTim
Posts: 72
Joined: Mon Aug 16, 2010 5:32 pm
Location: NRW, Germany

Post by TomTim »

Sylence wrote:Because - as I've written above - I saw no sense in making the library a DLL...
I don't mean IrrINI, but Irrlicht ... ;)
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Ah... well there is no class marked as export because Irrlicht does not export any class. Only the two function createDevice and createDeviceEx are exported and they are marked with IRRLICHT_API
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
TomTim
Posts: 72
Joined: Mon Aug 16, 2010 5:32 pm
Location: NRW, Germany

Post by TomTim »

Sylence wrote:Ah... well there is no class marked as export because Irrlicht does not export any class. Only the two function createDevice and createDeviceEx are exported and they are marked with IRRLICHT_API
Oh ... OK, that explains a lot. Thanks, I'll try it out. :D
TomTim
Posts: 72
Joined: Mon Aug 16, 2010 5:32 pm
Location: NRW, Germany

Post by TomTim »

It doesn't work, and I don't why. When I try to compile it, it shows me:

Code: Select all

1>IrrINI.cpp(12): error C2375: 'irr::io::createIniFile': re-definition; different linkage
1>IrrINI.cpp(17): error C2375: 'irr::io::createIniFile': re-definition; different linkage
1>IrrINI.cpp(22): error C2375: 'irr::io::createIniFileEmpty': re-definition; different linkage
The header:

Code: Select all

//! Creates an IrrIni object from a filename. You need to pass a valid pointer to the filesystem if you want to save the file to disk.
__declspec(dllexport)IrrIni* createIniFile(const c8* file, IFileSystem* fileSystem=0, bool saveOnDestroy=false);
//! Creates an IrrIni object from an already opend file. You need to pass a valid pointer to the filesystem if you want to save the file to disk.
__declspec(dllexport)IrrIni* createIniFile(IReadFile* file, IFileSystem* fileSystem=0, bool saveOnDestroy=false);
//! Creates an empty IrrIni object. If you pass 0 for a filesystem pointer you cannot save the file disk later.
__declspec(dllexport)IrrIni* createIniFileEmpty(IFileSystem* fileSystem=0);
The code:

Code: Select all

__declspec(dllexport)IrrIni* createIniFile(const c8* file, IFileSystem* fileSystem, bool saveOnDestroy/* =false */)
{
	return new CIrrIniStub(fileSystem, file,saveOnDestroy);
}

__declspec(dllexport)IrrIni* createIniFile(io::IReadFile* file, IFileSystem* fileSystem, bool saveOnDestroy/* =false */)
{
	return new CIrrIniIrr(fileSystem, file,saveOnDestroy);
}

__declspec(dllexport)IrrIni* createIniFileEmpty(IFileSystem* fileSystem)
{
	return new CIrrIniStub(fileSystem,0,false);
}
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Hm ok that would have been the same way I'd done this.
Maybe add an extern "C" for the functions... but other than that I have no idea...
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
TomTim
Posts: 72
Joined: Mon Aug 16, 2010 5:32 pm
Location: NRW, Germany

Post by TomTim »

Nope.

Code: Select all

extern "C"__declspec(dllexport)IrrIni* createIniFile(const c8* file, IFileSystem* fileSystem=0, bool saveOnDestroy=false);
extern "C"__declspec(dllexport)IrrIni* createIniFile(IReadFile* file, IFileSystem* fileSystem=0, bool saveOnDestroy=false);
extern "C"__declspec(dllexport)IrrIni* createIniFileEmpty(IFileSystem* fileSystem=0);
Same error occurs.
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Well worked like a charm for me...

Here is the new download: http://www.btbsoft.org/downloads/?did=4
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
TomTim
Posts: 72
Joined: Mon Aug 16, 2010 5:32 pm
Location: NRW, Germany

Post by TomTim »

Sylence wrote:Well worked like a charm for me...

Here is the new download: http://www.btbsoft.org/downloads/?did=4
This is it. It's over, I re-install this stupid compiler. It does not change my project settings, it does not add existing files to my projects, it does not open files, I can't close the program normally ... die in hell, piece of junk, I am full with your incompetence, I will re-install you completly. :x

I guess it has nothing to do with your advices or your project, I furthermore guess that scrappy compiler tries to drive me crazy.

EDIT: So, I re-installed my compiler completly. And now, finally, it works. :D Thanks.
TomTim
Posts: 72
Joined: Mon Aug 16, 2010 5:32 pm
Location: NRW, Germany

Post by TomTim »

OK, I wanted to implement some new functions into IrrINI, and was rather succesful (I needed them for some types IrrINI doesn't support yet). A very simple question: are the values of the keys just read to the next whitespace or to the end of the line (data)?

If there is this line:

Code: Select all

[Window]
Driver=SOFTWARE DRIVER
, is just the word "SOFTWARE" saved by IrrINI or the whole "SOFTWARE DRIVER"? And no, I can't used the usual IrrINI::getValueDrv()-procedure, for this code is just a mere example, the real ini entry is much more complicated ...
Post Reply