[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting



Steve Baker wrote:

> Gregor Mueckl wrote:
> 
> 
>>My best computer is a P-III 500Mhz, which is even slower (and I'm not
>>even considering an upgrade yet; other computers in my home network will
>>be more urgent - like my good, old 486 Linux (file-/ YP- /Samba- /DNS-
>>/whatever-) server). And yes, it can do compilation rather fast. But
>>with a new binary there also is the need to restart the game engine (or
>>engines in case you develop a networked game as I do). With a script you
>>might avoid this.
>>
> 
> OK - for the third or fourth time in this thread...
> 


I've read it.


>    *NO* you don't need to restart the game engine to change out
>    a 'script' that's written in C or C++.
> 
> This isn't an opinion, I have major applications that work this way.
> 
> Since this message clearly isn't reaching some people, I deduce that
> many of us have not typed:
> 
>    man dlopen
> 


I've read this man page more than once. I've even used dlopen before.


> Here is what you do to have scripts written in C/C++ and have them

> replaced WITHOUT RESTARTING THE GAME:
> 


(lots of lines cut here)


> 
> So, you can actually edit and recompile parts of your program WHILE
> IT'S
> STILL RUNNING!!
> 


This works only if you have C-ish interface between the module and the 
core engine. But what if you pass on an instance of a class that's 
implemented in the module on to the engine and loose track of it (you 
would have to replace it, anyway)?

[Answer (deliberately?) omitted]


> This isn't unique to Linux - most UNIX'en have dlopen.  I believe there
> is a similar mechanism with DLL's under Windoze - although the API is
> subtly different.
> 


There is. I've worked with that once to get a Delphi core program to 
work together with a C++ DLL. Boy, that's been messy... :(


> There are also some options to dlopen that I skimmed past - these allow
> the physical attachment of the library to your executable to be delayed
> until you actually call one of the functions...well, something like that.
> I recommend using 'RTLD_NOW'.  You can also make symbols within your
> library available to other dynamically loaded libraries...but that gets
> messy fast - so don't go there!
> 
> 
>>This might be beneficial (and good for ones nerves) if
>>it's tiresome to get to the point where you can actually test the new
>>code after an engine restart.
>>
> 
> ...and there is no reason not to do it in C/C++.
> 


Answer above question first, please.

Gregor


PS: I hope I'm not too cynial in this reply. It's been so tempting... So 
if you feel hurt by this mail, I'd like appoligize.


-- 

*****************************************************
* Gregor Mueckl                 GregorMueckl@gmx.de *
*                                                   *
* The ChallengeOS project:                          *
* http://challengeos.sourceforge.net                *
*****************************************************
* Math problems?                                    *
* Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x].       *
*****************************************************