Hi Kevin:
The actual code unfortunately I am not within the power to fully disclose,
but let me describe what basically it was trying to do here:
the code is doing so simple statistics (lets assume a max-filter here) on a
real-time integer stream. Therefor it uses a c struct to hold the
state-machine info, something like:
typedef struct {
int a;
int b;
} state_t;
and after init, for each new incoming integer, there is a method to update
the state and compute the output:
int my_add_new_sample(state_t* state, int new_sample)
{
state->a = state->b;
state->b = new_sample;
return (a > b ? a : (b > new_sample ? b : new_sample));
}
I hope you get an idea of the case, in Julia I use:
cd("DIR_with_dll")
# test_data
data = [1 2 1 3 3 3 3 4 4 4 4 3 3 3 2 2 2 1 3 3 2 2 6 6 6 5 5 4 4 4 1 1 2]
immutable StateT
a::Int32
b::Int32
end
state = StateT(0,0)
n = length(data)
result = zeros(Int32, n, 1)
for i in 1:n
result[i] = ccal((:my_add_new_sample, "My.dll"), Int32, (Ptr{StateT},
Int32), &state, int32(data[i]))
if result[i] != 0 println(result[i]) end
end
Hope this explains what's going on.
Thanks for the help!
On Thursday, April 2, 2015 at 9:50:46 PM UTC-7, Kevin Squire wrote:
>
> Hi Siyi,
>
> Can you give a short example of your code? It's generally pretty hard to
> debug these things without that.
>
> Cheers!
> Kevin
>
> On Thursday, April 2, 2015, Siyi Deng <[email protected] <javascript:>>
> wrote:
>
>> Hi,
>> I have created a c shared library using visual-studio; then I called the
>> c functions in Juno IDE, everything worked as expected.
>>
>> Then I installed the julia command line version, and ran the same script
>> again, and this time it seems that the c functions has not been called
>> properly, no exception was thrown, but the functions never return
>> meaningful values.
>>
>> I was using the 64bit stable release in both cases.
>>
>> Any insight? Thanks!
>>
>