News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Links an assembly file with a C/C++ file

Started by czx_204, May 16, 2012, 10:45:59 AM

Previous topic - Next topic

czx_204

Here is the code in C++:


   #include <iostream>
   using namespace std;
   double CombineC(int a, int b, int c, int d, int e, double f)
   {
         return (a+b+c+d+e)/(f+1.5);
   }

   // NOTE: extern "C" needed to prevent C++ name mangling
   extern "C" double CombineA(int a, int b, int c, int d, int e, double f);

   int main(void)
   {
         cout << "CombineC: " << CombineC(1,2,3,4, 5, 6.1) << endl;
         cout << "CombineA: " << CombineA(1,2,3,4, 5, 6.1) << endl;
         return 0;
   }

   
I want the CombineA function to do the same thing as CombineC does and to be written in .asm. The program is in 32-bit.

We are using MASM32 ver11 and Visual Studio 2010. Could anyone simply write the assembly part for this and tell me what I should do to link them?

Sorry I don't have any experience about either assembly or C but have to do this... Any help will be appreciated!

ragdog


hutch--

> Sorry I don't have any experience about either assembly or C but have to do this... Any help will be appreciated!

If you neither write C or assembler, the solution is "Rent A Coder". This forum is not a grovelware emporium.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php