RootTalk


ROOT Discussion Forums

cling reload/unload doesn't work?

Discuss installing and running Cling here. Please post bug reports here.

Moderator: cintdev

cling reload/unload doesn't work?

Unread postby NeoPhalynx » Thu Mar 14, 2013 23:27

Hi I was just wondering if there was a way to reload a file in cling. .L <same_file> seems to complain that the definitions are already there. (as oposed to cint reloading) are there any plans to fixing this functionality in cling?
NeoPhalynx
 
Posts: 5
Joined: Tue Mar 12, 2013 18:24

Re: cling reload/unload doesn't work?

Unread postby vvassilev » Fri Mar 15, 2013 8:45

Hi,
Absolutely. This will come as part of ROOT 6.
Cheers,
Vassil
vvassilev
 
Posts: 54
Joined: Mon Dec 20, 2010 17:56

Re: cling reload/unload doesn't work?

Unread postby NeoPhalynx » Sat Mar 16, 2013 7:57

Awesome! will there be any shortcuts to reload modified files without specifying the filename?
NeoPhalynx
 
Posts: 5
Joined: Tue Mar 12, 2013 18:24

Re: cling reload/unload doesn't work?

Unread postby vvassilev » Sat Mar 16, 2013 9:15

Hi,
This is a nice idea. It should be possible to implement such a command. But let's make the unloading work first and then we will see.
Cheers,
Vassil
vvassilev
 
Posts: 54
Joined: Mon Dec 20, 2010 17:56

Re: cling reload/unload doesn't work?

Unread postby NeoPhalynx » Sun Mar 17, 2013 22:28

cool. cling + reload functionality would = one of the most powerful programming tools I've ever used!
NeoPhalynx
 
Posts: 5
Joined: Tue Mar 12, 2013 18:24

Re: cling reload/unload doesn't work?

Unread postby shailesh41 » Fri Jun 21, 2013 15:42

Hi,

Unloading/Reloading will be an awesome feature. I am interested in understanding how the implementation will work . For ex: What will happen to the object and its pointers which is pointing to the class which is unloaded ? Will it be dangling ? potential crashes ?
Once when it is unloaded and and same class is loaded again with some changes will these pointers point automatically to newly loaded class ?

Thanks,
Shailesh.
shailesh41
 
Posts: 1
Joined: Thu Jun 20, 2013 14:31

Re: cling reload/unload doesn't work?

Unread postby pcanal » Wed Jun 26, 2013 18:54

Hi Shailesh,

What will happen to the object and its pointers which is pointing to the class which is unloaded ? Will it be dangling ? potential crashes ? Once when it is unloaded and and same class is loaded again with some changes will these pointers point automatically to newly loaded class ?


When unloading we will attempt to unload all the dependent libraries, however you can still end up in the situation you are describing (for example if what you unload if the implementation of a derived class and you are stored the pointer in a collection of base class pointer). In those situation, for better or worse, there is not much the unloading can do about leaving those pointer dangling (and being wrong if you reload a different definition of the derived class). Solving this would require to monitor and record (almost) every object allocation which would be an overkill (and thus a large performance penalty) in the general case.

Cheers,
Philippe.
pcanal
 
Posts: 6288
Joined: Wed Aug 27, 2003 14:22
Location: Fermilab

Re: cling reload/unload doesn't work?

Unread postby NeoPhalynx » Wed Jul 10, 2013 23:55

in the case of all the dangling pointers and unsafe objects, will it be possible to reset the environment while still enjoying the priviledge of a reloaded source file? Y'know just a shallow reset?
NeoPhalynx
 
Posts: 5
Joined: Tue Mar 12, 2013 18:24

Re: cling reload/unload doesn't work?

Unread postby pcanal » Thu Jul 11, 2013 0:36

Hi,

I am not sure what you mean. A 'shallow reset' seems to be pretty much what we already do (delete all the global object and function static and reload the definitions).

Cheers,
Philippe.
pcanal
 
Posts: 6288
Joined: Wed Aug 27, 2003 14:22
Location: Fermilab

Re: cling reload/unload doesn't work?

Unread postby NeoPhalynx » Fri Aug 02, 2013 4:19

oh ok perfect, no that's exactly what i meant :)

Ok now I have another question sorry :(
Upon the event of loading source files, might there be a way to customize a shell command before the load? for example, I use this tiny program to replace personally unique macros in my source files with valid c++ code. Sort of basically doing sed on the file to replace all x characters with y characters.
So might there be a way to customize a load call that runs that kind of shell command for you instead of processing my source files manually before loading them ? ( you know maybe like you can pass the filename parameter to a personal shell command )
NeoPhalynx
 
Posts: 5
Joined: Tue Mar 12, 2013 18:24

Re: cling reload/unload doesn't work?

Unread postby pcanal » Fri Aug 02, 2013 15:44

HI,

That depends how you load/compile your script. In similar case I just use (#define MACRO correct_stuff) for interpreter function and -DMACRO=correct_stuff passed to the compiler and/or ACLiC to have the C++ preprocessor do the replacement at compile/interpret time rather than having to modify the source file.

Cheers,
Philippe.
pcanal
 
Posts: 6288
Joined: Wed Aug 27, 2003 14:22
Location: Fermilab


Return to Cling Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron