[Icc-mot] Mixed C/ASM pointers
Lance B. Smith
lance at rapidware.com
Sat Aug 4 20:18:35 PDT 2007
Jim --
Without reading up on all of this assembly interface, you might try:
;Assembly (as before)
_vmdc: .asciz "hello world"
.globl _vmdc
/* C: */
extern const char *vmdc;
void speak(const char *msg[]);
/* ... */
speak(&vmdc);
It seems like your way should work, but it appears the compiler may need to
go back one level of indirection.
Regards
-- Lance
-----Original Message-----
From: icc-mot-bounces at imagecraft.com [mailto:icc-mot-bounces at imagecraft.com]
On Behalf Of Jim Fiocca
Sent: Saturday, August 04, 2007 10:59 PM
To: Discussion List for ICC08/11/12/16 users. You do NOT need to subscribe
toicc-announce if you are a member of this.
Subject: [Icc-mot] Mixed C/ASM pointers
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
_______________________________________________
Icc-mot mailing list
Icc-mot at imagecraft.com
http://dragonsgate.net/mailman/listinfo/icc-mot
More information about the Icc-mot
mailing list