Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
error: 'BIOSInfo' undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
error: Parse error before "BIOS_Info_Pointer"
error: 'BIOSInfo' undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
error: Parse error before "BIOS_Info_Pointer"
What is GCC trying to say?
GCC is trying to tell you that it didn't see a declaration for "BIOSInfo" at that point, and that it's not going to say that again (unlike sun's javac...). It will not go further.
You declared "struct BIOSInfo". You did not declare "BIOSInfo".
. The first X defines the name of the struct, the second one defines the name of the typedef. You can leave the first one out even, but that leaves you without "struct X"
The extern declaration of the function says it returns "BIOSInfo" but the variable is "BIOSInfo*", you need to change the function to return a pointer.
ld complains about not finding the reference to "_Get_ASM_Params". For some reason ld doesn't complain when I'm using "extern BIOSInfo Get_ASM_Params(void);"?
Any pointers?
Are you compiling to COFF? All variables and data that will be used in C need to prefixed with underscores for some reason if you are. You'll need to put an underscore on the start of the name in the Assembly.
BTW. Is there a reason you can't just use inline Assembly, or a direct pointer?
Googles wrote:
ld complains about not finding the reference to "_Get_ASM_Params". For some reason ld doesn't complain when I'm using "extern BIOSInfo Get_ASM_Params(void);"?
You may wish to use -fno-leading-underscore when compiling ... The COFF-base ABI try to prepend an underscore to every generated symbol to maintain compatibility with DOS/Windows linking environment.
How can people say "asm is harder than C". Okey, in asm you have to take care of everything, but in C you have to use alot of cryptic operators to describe what you don't know (like memory!) ???
The reasons that first come to mind are; ASM is harder to read later and lacks the ability to structure it easily and you have to write a lot of operators for something that you would think is simple, for example:
C has pretty much the same concepts as ASM though, like a pointer is an address which you can dereference, in Intel ASM you dereference with [ ] where in C it's *.
AR wrote:
The reasons that first come to mind are; ASM is harder to read later and lacks the ability to structure it easily and you have to write a lot of operators for something that you would think is simple, for example:
C has pretty much the same concepts as ASM though, like a pointer is an address which you can dereference, in Intel ASM you dereference with [ ] where in C it's *.
In this case, the C code tells me that "while the object exists and its done is not true" X will be done. I can't read that from the asm version even though it does function the same. Also, if some of the symbolic constants aren't given clear names, they're less clear.
This example can use structs, but it can't be enhanced much.