M
mwebel
Hi,
i am using a function from a C library which happens to use a lot of
static variables and functions.
The library used to be a executable but was turned into dll library.
My problem is that while i can call this function a first time... a
second time call will crash.
It seems that static values or functions are not fully reseted at the
end of each call.
I thought of two options:
-Hard, time consuming one: try to clean by hand on the C code, which
is very complex. and i am most likely to break something.(i already
tried but its really complex)
- Seemingly easy: wrap the function in a "protected zone"?
I though of option 2 as being able to wrap the function so it kinda
receives its own memory space with a brand new set of variables
everytime it is called. It might be a bit of a waste of memory but
since its only a couple of MB and i need it like mostly 2 or three
times: thats ok.
sofar i tried creating a class which wraps around that one function...
like:
class Function{
int myfunct( int param, Obj param2{
dllfunct(param, param2)
}
}
then creating an object for every call and then destroying it before
the second call.... but the static are still there(which of course is
sometimes the purpose of using them).
so are there any other things i might try?
thanks for any Ideas!
i am using a function from a C library which happens to use a lot of
static variables and functions.
The library used to be a executable but was turned into dll library.
My problem is that while i can call this function a first time... a
second time call will crash.
It seems that static values or functions are not fully reseted at the
end of each call.
I thought of two options:
-Hard, time consuming one: try to clean by hand on the C code, which
is very complex. and i am most likely to break something.(i already
tried but its really complex)
- Seemingly easy: wrap the function in a "protected zone"?
I though of option 2 as being able to wrap the function so it kinda
receives its own memory space with a brand new set of variables
everytime it is called. It might be a bit of a waste of memory but
since its only a couple of MB and i need it like mostly 2 or three
times: thats ok.
sofar i tried creating a class which wraps around that one function...
like:
class Function{
int myfunct( int param, Obj param2{
dllfunct(param, param2)
}
}
then creating an object for every call and then destroying it before
the second call.... but the static are still there(which of course is
sometimes the purpose of using them).
so are there any other things i might try?
thanks for any Ideas!