Jump to page: 1 2 3
Thread overview
Runtime code reloading in D, part 1
Dec 30, 2012
Benjamin Thaut
Dec 30, 2012
bearophile
Dec 30, 2012
Benjamin Thaut
Dec 30, 2012
F i L
Dec 30, 2012
r_m_r
Dec 31, 2012
Benjamin Thaut
Jan 05, 2013
ixid
Jan 06, 2013
Benjamin Thaut
Jan 06, 2013
bearophile
Jan 06, 2013
Jacob Carlborg
Jan 06, 2013
Johannes Pfau
Jan 06, 2013
David
Jan 06, 2013
Johannes Pfau
Jan 06, 2013
Dmitry Olshansky
Jan 06, 2013
Philippe Sigaud
Jan 06, 2013
Dmitry Olshansky
Jan 06, 2013
Dmitry Olshansky
Jan 06, 2013
Benjamin Thaut
Jan 05, 2013
Jacob Carlborg
Jan 06, 2013
Benjamin Thaut
Jan 06, 2013
Jacob Carlborg
Jan 06, 2013
Benjamin Thaut
Jan 06, 2013
Jacob Carlborg
Jan 06, 2013
Benjamin Thaut
Jan 06, 2013
Jacob Carlborg
Jan 06, 2013
Benjamin Thaut
December 30, 2012
An article about runtime code reloading in the context of game developement. A topic I'm currently working on in my spare time. I hope it holds some valuable information for everyone working with D.

http://3d.benjamin-thaut.de/?p=25

Kind Regards
Benjamin Thaut
December 30, 2012
Benjamin Thaut:

> http://3d.benjamin-thaut.de/?p=25

>The pointer to the RTTI information for each member is a workaround for a strange bug I encountered. For POD structs the rtInfo template will be instancated, but for some reason you can not query the results at runtime. It is possible that the linker stripps the information away but I could not yet investigate this issue further. If I can not query the RTTI information at runtime I fallback to the RTTI info pointer stored in the “next” member of thMemberInfo.<

This seems one of the situations where knowing "why" is almost more important than "doing": understanding the cause, and maybe even fixing it, will help future D programmers.

Bye,
bearophile
December 30, 2012
Am 30.12.2012 14:27, schrieb bearophile:
>
> This seems one of the situations where knowing "why" is almost more
> important than "doing": understanding the cause, and maybe even fixing
> it, will help future D programmers.
>
> Bye,
> bearophile

The problem only happens if you have a POD struct in a library file (.lib). If the POD struct is directly in the main executable everything works just fine. The only hint Walter gave me when I opened a thread in the D newsgroup was "look at the difference of the object files".

I don't really know how that should be done atm.

Kind Regards
Benjamin Thaut
December 30, 2012
On Sunday, 30 December 2012 at 12:32:00 UTC, Benjamin Thaut wrote:
> An article about runtime code reloading in the context of game developement. A topic I'm currently working on in my spare time. I hope it holds some valuable information for everyone working with D.
>
> http://3d.benjamin-thaut.de/?p=25
>
> Kind Regards
> Benjamin Thaut

Awesome, thanks for the post. I've been playing around with this idea for awhile, and that article is immensely helpful.

Proper .so/.dll support is very needed for this, and I hope something is happening on that front.
December 30, 2012
On 12/30/2012 06:02 PM, Benjamin Thaut wrote:
> An article about runtime code reloading in the context of game
> developement. A topic I'm currently working on in my spare time. I hope
> it holds some valuable information for everyone working with D.

Thanks for the article. It was very informative. Waiting for the next part :-)

regards,
r_m_r
December 31, 2012
  Do you find that D without GC is more effective than C++? Seems like you would be stuck using structs which seems somewhat limiting, even compared to C++...

 UE4 has similar reloading capabilities(using DLLs), though they use C++ and rely more on the ability to serialize everything




December 31, 2012
Am 31.12.2012 15:02, schrieb DypthroposTheImposter:
>    Do you find that D without GC is more effective than C++? Seems like
> you would be stuck using structs which seems somewhat limiting, even
> compared to C++...
>
>   UE4 has similar reloading capabilities(using DLLs), though they use
> C++ and rely more on the ability to serialize everything
>

Why should I be stuck with structs? Its the exact same as in C++. I did build my own new and delete operators (as templates). It's not that hard and works pretty well, only the syntax is not ideal in some cases. I can use everything you can use with D+GC. Sometimes you have to be carefull with implict allocations (e.g. closures, array literals) but I have a leak detector that points me to these directly and usually its easy to free these manually.

And I'm quite a bit more productive then in C++. Module constructors with a defined order instead of random static initalizers,
code generation isnstead of huge amounts of boilerplate code and many other features are the cause of this.

Kind Regards
Benjamin Thaut

January 05, 2013
On Monday, 31 December 2012 at 14:40:48 UTC, Benjamin Thaut wrote:
> Am 31.12.2012 15:02, schrieb DypthroposTheImposter:
>>   Do you find that D without GC is more effective than C++? Seems like
>> you would be stuck using structs which seems somewhat limiting, even
>> compared to C++...
>>
>>  UE4 has similar reloading capabilities(using DLLs), though they use
>> C++ and rely more on the ability to serialize everything
>>
>
> Why should I be stuck with structs? Its the exact same as in C++. I did build my own new and delete operators (as templates). It's not that hard and works pretty well, only the syntax is not ideal in some cases. I can use everything you can use with D+GC. Sometimes you have to be carefull with implict allocations (e.g. closures, array literals) but I have a leak detector that points me to these directly and usually its easy to free these manually.
>
> And I'm quite a bit more productive then in C++. Module constructors with a defined order instead of random static initalizers,
> code generation isnstead of huge amounts of boilerplate code and many other features are the cause of this.
>
> Kind Regards
> Benjamin Thaut

Is D moving away from your sort of use? Games and bioinformatics
would seem to be the areas the language should be trying to get
people to start using it in. The features you're using seem very
much like they should be a part and mode of using the language.
January 05, 2013
On 2012-12-30 13:32, Benjamin Thaut wrote:
> An article about runtime code reloading in the context of game
> developement. A topic I'm currently working on in my spare time. I hope
> it holds some valuable information for everyone working with D.
>
> http://3d.benjamin-thaut.de/?p=25

This looks very cool. Question, are you manually triggering the code for generating the RTTI?

BTW, have you seen this old project implementing runtime reflection:

http://flectioned.kuehne.cn/

-- 
/Jacob Carlborg
January 06, 2013
Am 05.01.2013 12:15, schrieb Jacob Carlborg:
> On 2012-12-30 13:32, Benjamin Thaut wrote:
>> An article about runtime code reloading in the context of game
>> developement. A topic I'm currently working on in my spare time. I hope
>> it holds some valuable information for everyone working with D.
>>
>> http://3d.benjamin-thaut.de/?p=25
>
> This looks very cool. Question, are you manually triggering the code for
> generating the RTTI?
>
> BTW, have you seen this old project implementing runtime reflection:
>
> http://flectioned.kuehne.cn/
>

Yes I know flectioned. But I did not require that much RTTI information. No I'M not manually triggering the code for generating the RTTI. As mentioned in the article it is done via the RTInfo template inside object_.d / object.di which is automatically instanciated for each type used during compilation.

Kind Regards
Benjamin Thaut
« First   ‹ Prev
1 2 3