March 28, 2024, 21:42
bigger smaller reset     1020px Wide width Full width Reset   * *

Gildor's Forums

  Homepage Facebook Read news on Twitter Youtube channel Github page
Welcome, Guest. Please login or register.
Did you miss your activation email?

« previous next »
Print
Author Topic: Umodel source code  (Read 18089 times)
GambitAnimating
Sponsor
Newbie
*
Posts: 29


View Profile
« Reply #15 on: July 10, 2018, 05:12 »

Hey Gildor, I’m trying to use #include <iostream> and other c++ libs but umodel doesnt seem to let me do this, if I wanted to use the iostream would I need to include it after certain code was called or how could I do this? Thanks for your time Smiley (I’m building for windows 32 bit)
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #16 on: July 10, 2018, 07:24 »

I'm not using STL, and even disabled C++ exceptions in project's settings. UModel's Core has everything what's needed.
Logged
GambitAnimating
Sponsor
Newbie
*
Posts: 29


View Profile
« Reply #17 on: July 10, 2018, 20:15 »

I see, is there any way to use tge STL if I wanted to though? Currently it seems to allow most c headers but not many C++ headers, is this a setting I can maybe change so I can add things and learn for personal use or is it not possible? Thanks
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #18 on: July 10, 2018, 20:40 »

What happens when you're trying to include STL headers?
Do you use MSVCRT library for building UModel? (this MSVCRT build should not be compatible with STL)
Logged
GambitAnimating
Sponsor
Newbie
*
Posts: 29


View Profile
« Reply #19 on: July 10, 2018, 22:15 »

I get this error when I try to use #include <iostream> or any other STL header - https://i.imgur.com/0emTCAj.png (if I take out the STL it builds fine) in common.project I have commented out #OLDCRT = 1 and changed LIBC to static so I don't believe I'm using the MSVCRT library for building. If I was however, how would I build with something other than it to get STL headers to work?
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #20 on: July 10, 2018, 22:37 »

The problem here is conflict with my "operator new" and STL's one. There's nothing related to compiler, CRT library etc.
Probably you should include STL header AFTER my headers. Or may be disable STL's operator new in some way.
Logged
GambitAnimating
Sponsor
Newbie
*
Posts: 29


View Profile
« Reply #21 on: July 10, 2018, 23:13 »

So like after all the headers you include in UmodelTool/main.cpp or is that not the last of your includes? Because if I include it after all your headers in main.cpp I get this error https://i.imgur.com/zphKFF9.png can I edit your "operator new" in some way to get it to work, or any idea what I might do to get it working?
« Last Edit: July 11, 2018, 01:05 by GambitAnimating » Logged
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #22 on: July 11, 2018, 11:18 »

You can disable STL's "operator new" by defining _NEW_ constant - this is a hack which will prevent including file "new" (with no extension).

Actually it is very very hard to replace or override STL's operator new in any application, so I'd rather recommend you using my API or CRT instead of STL. You can't disable my "operator new" because my UE framework relies on it. For instance, my memory allocation function clears allocated memory with zeros, and most of code expects this behavior.
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #23 on: July 11, 2018, 11:38 »

Probably it would be possible to make operator new/delete non-inline and put them to cpp (I didn't try that by myself)
Logged
GambitAnimating
Sponsor
Newbie
*
Posts: 29


View Profile
« Reply #24 on: July 11, 2018, 12:04 »

Would making the operator non-inline effect the conflict even? Also if that wouldnt really effect it, can you further explain the hacky was, what do you mean by “dedining _NEW_ constant? Thanks for your time
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #25 on: July 11, 2018, 12:12 »

I didn't try to mix UModel with STL code, so these are just my assumptions.

Defining _NEW_ constant will do the following: in "new" header, there's include guards:
Code:
#ifndef _NEW_
#define _NEW_
...
#endif
So, for Visual Studio this will exclude this header from processing. Of course, this is a hack.

Trying to move operator new implementation from header to cpp MAY help, and this is an alternative solution. Probably compiler will use declaration from #include <new>, but implementation will be mine.
Logged
GambitAnimating
Sponsor
Newbie
*
Posts: 29


View Profile
« Reply #26 on: July 14, 2018, 04:40 »

Defining NEW didn't work btw because then it had other conflict errors and I'd most likely have to keep defining those plus changing some other code while not even knowing if in the end it would work, haha so I stuck to C programming Tongue
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #27 on: July 14, 2018, 09:10 »

"Not using STL" doesn't mean "C programming".
Logged
GambitAnimating
Sponsor
Newbie
*
Posts: 29


View Profile
« Reply #28 on: July 14, 2018, 12:40 »

No I meant I only did c functions for the things I needed, haha I know that much, STL is just Standard Library Headers Tongue I know I coupd if still used C++ things
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #29 on: July 14, 2018, 12:48 »

If you need a particular STL feature, you may ask if something similar is implemented with UModel's framework. I'm trying to keep framework's API similar to UE4 one. The only thing which is really missing is std::map (TMap).
Logged
Print 
« previous next »
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Leviathan design by Bloc | XHTML | CSS