Re: [Vala] trying vapi file for ngspice, segfaults



vala-list-request gnome org schreef op wo 21-05-2014 om 12:00 [+0000]:
I don't know why you think these are out parameters?based on a quick
look at the documentation they seem like in parameters.

i am wondering why i was thinking it. It almost works but i got a
problem when trying to use the init function and passing a test function
as the delegate.

i used the vapi you proposed.

[CCode (cname = "SendChar", simple_generics= true, has_target = false)]
                public delegate int SendOutput<T> (string sendToCaller, int  id, T data);

[CCode (cname = "ngSpice_Init",simple_generics = true)]
                public static int init<T>(SendOutput<T>? a, SendSimulationStatus<T>? b, ControlledExit<T>? c, 
 SendVectorData<T>? d,  SendInitializationData<T>? e,IsBackgroundThreadRunning<T>? f, T data);


but on compile i get this:

gint elektro_sim_ng_spice_simulator_test (GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify 
t_destroy_func, const gchar* stdout, gint id, gconstpointer data);

and here it obviously fails

static gint _elektro_sim_ng_spice_simulator_test_send_char (const gchar* sendToCaller, gint id, gconstpointer 
data) {
        gint result;
        result = elektro_sim_ng_spice_simulator_test (sendToCaller, id, data);
#line 41 "/home/steven/projecten/ElektroSimgit/ElektroSim/NGSpiceSimulator.vala"
        return result;
#line 103 "NGSpiceSimulator.c"
}

the code i use in vala is this(in constructor off a class:

        
        ngspice.init<int>(this.test, null, null, null, null, null,5);
        
        public static int test<T>(string stdout,int id, T data){
                stdout.printf ("stdout: '%s'\n", stdout); //debug line
                return id;
        }

any thoughts? i tried to remove the static but then it wont even complete the vala compile, ccode or vapi 
changes affect the GBoxedCopyFunc, GDestroyNotify and const gchar* stdout who are added
to the test function in c, Or is is the send char static function that is not correct?

greets,
Steven



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