Compilation mistake with a C and ASM programs

From: skweek (spamtrap_at_crayne.org)
Date: 02/24/05


Date: Thu, 24 Feb 2005 18:31:28 +0000 (UTC)

Hello,

I'm using visual studio 6.0 sp 5 with the processor pack.
I would like use a C variable with my C program but visual c giving me
and unreconized symbol, and i don't know why :/

test.obj : error LNK2001: unresolved external symbol _toto
Debug/uuu.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

uuu.exe - 2 error(s), 0 warning(s)

I'm pasting my example :

1. I'm creating a visual studio Console project and i'm writting the
folliwing code :

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

extern "C" void compute();
char *toto;
void main(void)
{

        int i;
        toto = ( char *) calloc (11, sizeof( char));

        compute();

        /*for (i = 0 ; i < 10 ; i++)
        {
                toto[i] = 'A'+i;
        }*/
        printf("%s",toto);
        
        //getch();
        free(toto);
        
}

2. The Asm program :

.586
.model flat,C

public compute
extrn toto:dword ; i tried to put extrn _toto:dword , extrn _toto :
byte, extrn toto : byte, and i don't works :/
.data
zeroo dd 0

.code

compute proc

        mov esi, toto ; idem for extrn , i tried _toto too
        mov eax,'A'
        xor ecx,ecx

_loop:
        mov byte ptr [esi],al
        inc ecx
        inc esi
        inc eax
        cmp ecx,10
        jne _loop

        

ret
compute endp

end

3. I'm setting up the asm file compilation directive : Custom build :
ml.exe -c -coff -Cx -Fo$(IntDir)\$(InputName).obj $(InputName).asm
and outputs : $(IntDir)\$(InputName).obj

Thanks you for your help, and please accept my apologize for my bad
english :/ Have a nice day ;o)

Sincerly,

skweek



Relevant Pages