[Icc-mot] Mixed C/ASM pointers

Jim Fiocca jim at fiocca.net
Sun Aug 5 11:09:29 PDT 2007


Didn't intend to blame the compiler, just looking for a solution to my 
problem.  And this one works - thanks!

Jim


Richard wrote:
> User error, try
>
> extern const char vmdc[];
>
> in your C file. Pointers and arrays are NOT the same.... (if I get a 
> dollar for every time the compiler gets blamed :-) )
>
> At 07:59 PM 8/4/2007, Jim Fiocca wrote:
>> I'm having trouble referencing assembly language pointers in C.
>>
>>   In the assembly file I have:
>> _vmdc:  .asciz  "hello world"
>>         .globl  _vmdc
>>
>>   In the C file I have:
>> extern const char *vmdc;
>> void   speak(const char *msg);
>>
>>   And then I reference it like this:
>>         speak(vmdc);
>>
>> And what happens is, the compiler passes 0x6865 (ASCII for 'he') 
>> instead of the address of the array.
>>
>> I can work around it with:
>>         speak(&vmdc);
>> but I use lots of assembly pointers and don't want to have to 
>> remember to use this bad practice all over my code.
>>
>> Thanks,
>>  Jim
>>
>
> // richard (This email is for mailing lists. To reach me directly, 
> please use richard at imagecraft.com)
> _______________________________________________
> Icc-mot mailing list
> Icc-mot at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-mot



More information about the Icc-mot mailing list