Search found 13 matches

by kekar
Fri Nov 04, 2011 7:06 am
Forum: Beginners Help
Topic: std::string to wchar_t*
Replies: 5
Views: 332

Re: std::string to wchar_t*

If you want to stick with C++ STL, you may also do this;

From basic string:

Code: Select all

 
std::string other("foobar");
const std::wstring& ws =  std::wstring(other.begin(), other.end());
const wchar_t* const wchr = wc.c_str();
 
You may also reverse it, replacing std::wstring with std::string.
by kekar
Mon Jul 11, 2011 8:37 pm
Forum: Beginners Help
Topic: Heap allocations
Replies: 21
Views: 1425

Re: Heap allocations

Thanks for additional information, it's really appreciated! Yes, it's the way I originally/vaguely thought it was, but I wasn't 100% sure. The documentation do say explicitly/clearly state that you're totally responsible for the reference count of heap objects to they gets deleted when making new ob...
by kekar
Sun Jul 10, 2011 6:03 pm
Forum: Beginners Help
Topic: Heap allocations
Replies: 21
Views: 1425

Re: Heap allocations

Hm, yes, that seems to solve it..
by kekar
Sun Jul 10, 2011 5:51 pm
Forum: Beginners Help
Topic: Heap allocations
Replies: 21
Views: 1425

Re: Heap allocations

Thanks for that clarification Xaryl! I've done a few tests like the following code. It's the only thing run in the main function and it uses some part of my API towards Irrlicht. BMUCtxInst::instance() is just a singleton that gives access to the Irrlicht initialized API (ensured to be initialized o...
by kekar
Sun Jul 10, 2011 3:09 pm
Forum: Beginners Help
Topic: Heap allocations
Replies: 21
Views: 1425

Re: Heap allocations

The documentation clearly states that method starting with "create.*" must be handled with grab() and drop(), but I'm not sure if this is the case for other objects, if you for instance call "addImage(...)", you need to handle the reference count too, or you'll end up with a leak...
by kekar
Sat Jul 09, 2011 11:19 pm
Forum: Beginners Help
Topic: Heap allocations
Replies: 21
Views: 1425

Re: Heap allocations

So, in these parts of the documentations, the 'dropped'-statment just means that you shouldn't explicitly call "C++ delete" on it? I would *never* do that from objects ptrs. delivered from Irrlicht.. So the conclusion is, the Irrlicht-API functions that you call OTHER methods, without &quo...
by kekar
Sat Jul 09, 2011 10:48 pm
Forum: Beginners Help
Topic: Heap allocations
Replies: 21
Views: 1425

Re: Heap allocations

I know drop() isn't supposed to be called if you don't call grab().. But the docs. just states, simply, DON'T call drop on this call.. My question is, is the documentation faulty?
by kekar
Sat Jul 09, 2011 10:22 pm
Forum: Beginners Help
Topic: Heap allocations
Replies: 21
Views: 1425

Re: Heap allocations

Ok, so let's get this clear.. The documentation is not accurate, it's even, *way* vague/bad/misleading. From: IGUIImage* addImage(..) // No CREATE label.. \return Pointer to the created image element. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() f...
by kekar
Sat Jul 09, 2011 9:57 pm
Forum: Beginners Help
Topic: Heap allocations
Replies: 21
Views: 1425

Re: Heap allocations

You should not call drop if you did not call grab before. If you did you have to call drop. Read through the documentation of IReferenceCounted to clarify this. Thanks for your help. But a simple question, why is it stated in the documentation that you SHOULDN'T call drop()? If I grab() a heap obje...
by kekar
Sat Jul 09, 2011 9:48 pm
Forum: Beginners Help
Topic: Heap allocations
Replies: 21
Views: 1425

Re: Heap allocations

Or, do they actually allocate these things into the heap memory for the whole lifespan of the process? E.g. if a previously call has been done, a new exact call, anywhere (object instances), it will reuse the previously allocated data in memory? Meaning, that it isn't released before the process goe...
by kekar
Sat Jul 09, 2011 9:21 pm
Forum: Beginners Help
Topic: Heap allocations
Replies: 21
Views: 1425

Re: Heap allocations

I don't get it, if you *do* call grab(), for pointers delivered by these methods, how can the reference counter be balanced? It clearly states in the documentation that you explicitly should *not* call drop, when calling these parts of the API.
by kekar
Sat Jul 09, 2011 9:09 pm
Forum: Beginners Help
Topic: Heap allocations
Replies: 21
Views: 1425

Heap allocations

Hi, I have worked with Irrlicht API in c++ for over a 1/2 year now. I do understand the concept with grab() and drop(), generally, but I really wonder about these areas of the API; virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,bool useAlphaChannel=true, IGUIElement* p...
by kekar
Mon Dec 06, 2010 1:26 pm
Forum: Beginners Help
Topic: Can't find Irrlicht.lib [Solved]
Replies: 4
Views: 2041

so you actually need to use the irrlicht.dll, independently of the irrlicht.lib? whats the difference between the two? im on a different computer atm but ill try that tomorrow. thanks. The .DLL is dynamically linked in runtime when the executable runs. The .lib is a library archive and may be used ...