Reputation: 70
i have .lib file that i created in c++ with several functions.
_declspec(dllexport) int atoi_new(char * c , int len){
int ar = 0;
int f = 0;
for(int i = 0 ; i < len ; i++){
f *= 10;
ar = (int) c[i];
ar -= 0x30;
f += ar ;
}
return f;
};
this maybe not a good example but you get the idea . know i want to use this function from .lib file in nasm any idea how to do this ?
Upvotes: 0
Views: 210
Reputation: 22094
You should declare the functions as C, otherwise the names get mangled and you would have to look it up, what name the compiler made up.
#ifdef __cplusplus
extern "C" {
#endif
_declspec(dllexport) int atoi_new(char * c , int len);
#ifdef __cplusplus
}
#endif
or
extern "C" _declspec(dllexport) int atoi_new(char * c , int len);
Upvotes: 1