Solved

Linking Assembly code to C++

Posted on 1998-03-23
7
187 Views
Last Modified: 2010-04-10
can anybody help me how to create a link-able macro in Assembly language for C++ source code?
for example I want to create some routines in assembly that handle disk I/O and want to link them to my C++ code.
0
Comment
Question by:bluebird031198
  • 6
7 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1183752
Yes, I can help.  If you want qualifications, I've written a 500,000 line assembly language program.

Can you provide some details.?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1183753
What operatig system?  DOS I assume?
Is this for the x86 computers?
What C++ compiler?
Why not provide at least one example procedure of what you want?

0
 

Author Comment

by:bluebird031198
ID: 1183754
if can just give some examples in DOS, Unix, or even others OS.
thanks for all
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 1183755
Answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1183756
; A convenient macro for making DOS interrupt service calls.
BDOS          MACRO         U,V
              IFNB          <V>
              MOV       AL,V
              ENDIF
              MOV           AH,U
              INT           21H
              ENDM

; Assemply procedure top opne a file in DOS.  Caller specifies the file name and the mode to open in.  Procedure returns a non-zero handle if it succeeds.  zero if it fails.
; Returns
; AX file handle.
OPNFIL PROC NEAR PASCAL DWORD FILNAM,BYTE OPNMOD
   LDS DX FILNAM
   BDOS 3Dh,OPNMOD
  JNC OPNFILEND:
  XOR AX,AX

OPNFILEND: RET
OPNFIL END
0
 
LVL 22

Expert Comment

by:nietod
ID: 1183757
from C++ you would use.

extern "C" HANDLE OPNFIL(char *FilNam,char Mode);

handle FilHnd = OPNFIL("c:\autoexec.bat",0);
0
 
LVL 22

Expert Comment

by:nietod
ID: 1183758
That's about the best I can offer without more input from you.  
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question