Reputation: 1
I try to use external library. When i call function from this library it is work correct. But then i try call this function in the loop i have Segmentation fault. Code for example:
char *snam = (char*) new char;
QLibrary swedll("swedll32.dll");
typedef char * (*Fct)(int, char *);
Fct fct=(Fct)(swedll.resolve("_swe_get_planet_name@8"));
for(int i=0;i<100;++i)
{
if (fct) fct(0,snam);
}
What i am doing wrong?
Upvotes: 0
Views: 214
Reputation: 1
typedef char * (*Fct)(int, char *); Fct fct=(Fct)(swedll.resolve("_swe_get_planet_name@8"));
must change to
typedef __stdcall char * (*Fct)(int, char *); Fct fct=(Fct)(swedll.resolve("_swe_get_planet_name@8"));
Upvotes: 0