logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

problems resolving program in a cmod: msg#00068

Subject: problems resolving program in a cmod
>>Correct, as I said above, you probably want to use
>>parent_clone_object() (or just call the svalue directly). Do you
>>actually need the program pointer for something?
> 
>I need it to create an object of that program. I am a little confused
>though. If there is a simpler solution to create an object from the
>name of the program (const char*) i would like to know :-).

In that case, something like:

  push_text("Someclass");
  APPLY_MASTER("resolv", 1);
  if (UNSAFE_IS_ZERO(Pike_sp - 1)) {
    Pike_error("Could not resolve program Someclass.\n");
  }
  ref_push_*(arg1);
  ref_push_*(arg2);
  ...
  ref_push_*(argn);
  apply_svalue(Pike_sp - (n + 1), n);
  stack_pop_keep_top(1);        /* Pop the resolved value */

  /* Pike_sp-1 now (probably) contains the new object. */

probably does what you need.



<Prev in Thread] Current Thread [Next in Thread>