Learn how to a build a cloud-first strategyRegister Now


How to Prototype ??

Posted on 2005-04-10
Medium Priority
Last Modified: 2010-04-15
Hello. I have DevC++ and RaDASM with MASM32.
I made a program in assembly which I need to use from an C  Program. I generated the obj file . AThen in the C Ide in project options I added this obj file.

The question here is how must I use the .H file to use the assembly function and how can I use the function from main.c

This is my asm program

.model flat, stdcall
option casemap:none



Myproc proc var1:REAL4, var2:REAL4
    LOCAL retval:REAL4
    fld var1
    fld var2
    fstp retval
    fwait                ;<- is this really needed?
    mov eax, retval
Myproc endp

Question by:djhex
LVL 46

Accepted Solution

Kent Olsen earned 1000 total points
ID: 13749486
Hi djhex,

It looks like you have written an assembly function with a C header that looks like this:

real Myproc (real var1, real var2);

If you'll put that line in your .h file (or near the top of your .c file) you'll have an effective prototype.

There are several ways to get this assembly program into your application.

Perhaps the easiest is to start by compiling this into an object file (.obj).  Then configure the IDE to use this file in your project.

Good Luck!

Expert Comment

ID: 13763427
If thats your whole assembly program why not just use inline assembly and use your c compiler.
Your prototyping will be the same as for any c function.
It would be a lot simpler.

LVL 10

Author Comment

ID: 13763561
I cant use inline ase,bly

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Suggested Courses

810 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