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

.386 
.model flat, stdcall
option casemap:none



.data


.code

Myproc proc var1:REAL4, var2:REAL4
    LOCAL retval:REAL4
    finit
    fld var1
    fld var2

    fadd
    fstp retval
    fwait                ;<- is this really needed?
    mov eax, retval
    ret
Myproc endp


end;



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);


#endif
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 http://217.160.247.193/index.php?topic=16174.0 or http://217.160.247.193/index.php?topic=460.0 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