include assembly function in c++ MinGW -


i want include assembly function in c++. used google , found extern int test(int,int) works fine in c not in c++. have in c++? code:

#include <iostream>  extern int test(int,int);  int main () {   std::cout<<test(2,2); //here "../main.cpp:6: undefined reference `test'"   return 0; } 

i'm using eclipse mingw.

you can include assembly functions in c++ extern "c". working example:

#include <iostream>  extern "c" int test(int,int);  int main () {   std::cout<<test(2,2);   return 0; }   

mingw adds underscore function, have name _test in assembly.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -