Linking ASM Object File to C++ Program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Protoman

    Linking ASM Object File to C++ Program

    I'm trying to link this ASM file:

    ..486
    ..model flat
    ..stack
    ..code
    _sample proc
    push ebp
    mov ebp,esp
    sub esp,8
    push eax
    mov eax,[ebp+4]
    mul dword ptr[ebp+8]
    add eax,10
    pop eax
    mov esp,ebp
    pop ebp
    ret
    _sample endp
    end _sample

    to this C++ program:

    #include <iostream>
    #include <cstdlib>
    using std::cout;
    using std::endl;
    using std::system;
    extern "C" {int sample();}
    int main()
    {
    cout << sample() << endl;
    system("PAUSE") ;
    return EXIT_SUCCESS;
    }

    My compiler is Dev-Cpp and my assembler is MASM32. Am I supposed to
    create a project w/ the ASM file's object file in it, or what? Any help
    would be greatly appreciated. Thanks!!!!

  • Victor Bazarov

    #2
    Re: Linking ASM Object File to C++ Program

    Protoman wrote:
    I'm trying to link this ASM file:
    [..]
    >
    to this C++ program:
    >
    #include <iostream>
    #include <cstdlib>
    using std::cout;
    using std::endl;
    using std::system;
    extern "C" {int sample();}
    int main()
    {
    cout << sample() << endl;
    system("PAUSE") ;
    return EXIT_SUCCESS;
    }
    >
    My compiler is Dev-Cpp and my assembler is MASM32. Am I supposed to
    create a project w/ the ASM file's object file in it, or what? Any
    help would be greatly appreciated. Thanks!!!!
    We cannot help you with that. This is a _language_ newsgroup, not
    "how to use my development environment" newsgroup. Your C++ code is
    fine. Cross-language programming is platform- and implementation-
    specific. You need to ask in the newsgroup dedicated to your OS or
    your compiler.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask


    Comment

    Working...