Hello. I got an asm function. I did with RADASM and MASM32. It generated an obj file.

On Devc++ (my Ide) I included the obj file. in project options

But I dont know what should I put on this .h file and then how to call it from the main.c

I did this but I am not sure.

float MyProc(float var1, float var2);

This is my assembly function

.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


I did this on my C program

#include "H:\Practica Arquitectura del Computador\include\flotantes.h"

float MyProc(float, float);

void sum(void)
    float total2;
    total2 = MyProc(3.2, 4.2);
    printf("Total is: %d", total2);

But I get an error

  undefined reference to `MyProc'

my .h file is this

#ifndef _FLOTANTE_H
#define _FLOTANTE_H

float MyProc(float var1, float var2);

Posted on 2005-04-10 16:38:40 by luisvalencia
You should use extern "c" in the c header and perhaps global/public with the name of the label in the asm file you whant to by "searchable" by the linker.

perhaps or will help.

Also search the board and find the help of the assembler for know how to "publicate" a label in a object file.
Posted on 2005-04-10 21:51:43 by rea