Linking ASM Object File to C++ Program

P

Protoman

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!!!!
 
V

Victor Bazarov

Protoman said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top