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.
basically the title says it all, i have an object file made in asm and am trying to link it in codeblocks with mingw/ld and I know it is linking with the object file cause if i change the name it will say file not found but it is as if it wasnt linked because it says undefined reference to anything in the object file and i have opened it in a hex editor to make sure that the symbols were there and they are
here is my code
//c code
extern void gdt_flush(); //and i call it in a function after this line
;asm code
global _gdt_flush ;i have tried it with and without the underscore
_gdt_flush:
add bx,1 ;this is just here so it does something
ret
if anyone could help me it would be greatly appreciated; hopefully i havent broken my keyboard by the time someone replies to this
edit:
omfg i cant beleive how stupid i am i forgot to put the section .text in it
mods/admins can delete or lock this or whatever
Last edited by earlz on Sat Nov 05, 2005 12:00 am, edited 2 times in total.
Judging from my small knowledge, gdt_flush is an externel command from a dll right? If it's not and you're declaring it yourself you don't have to put extern before it.
no your way off
i was trying to make a pure asm function
the global means to export the symbol so that things that it is linked(other objects) can call the function and the gdt_flush: is just a label and the name of the function and is basically nothing more than a bookmark for where the function is in the compiled code
the extern in the C code basically tells the compiler "ignore that the function is not in the C source code being compiled" and it is put with it at link time and not compiler time; but this does not mean it is loaded at runtime it is loaded at link and if the symbol is not found at link time then you get a nice little undefined reference error
and no this is osdev not dll stuff even though i would kill someone if i could put in dll support in my own os