flat assembler
Message board for the users of flat assembler.
Index
> High Level Languages > problem linking 64bit .obj file to c code |
Author |
|
revolution 30 Aug 2009, 17:42
madmatt wrote: ... (?fasm_rndintq32@@YAII@Z)... Code: public fasm_rndintq32 as '?fasm_rndintq32@@YAII@Z' |
|||
30 Aug 2009, 17:42 |
|
Fanael 30 Aug 2009, 18:13
madmatt, you're compiling as C++, not C! Put extern "C" before declaration, e.g.:
Code: extern "C" unsigned int fasm_rndintq32(unsigned int); |
|||
30 Aug 2009, 18:13 |
|
chaoscode 30 Aug 2009, 18:23
the problem is the naming convention and the use of the same funktion with diffenent parameters (in German we call it "Überladen" the englisch translation would be "Overloading" or sth simmilar)
in C there was a underscore before the function and thats all. but in c++ you can have more functions with the same name but diffenrent type of Parameters. e.g.: char* translate(double d); char* translate(float f); char* translate(void* target, char* mem1, int[] stuff); and the compiler generates from the parameters an additional string that the compiler appends to the Function name so that it can identyfi every function. see http://www.daniweb.com/forums/thread8072.html# http://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B_Name_Mangling |
|||
30 Aug 2009, 18:23 |
|
Fanael 30 Aug 2009, 19:30
chaoscode wrote: in C there was a underscore before the function and thats all |
|||
30 Aug 2009, 19:30 |
|
madmatt 30 Aug 2009, 20:04
Fanael
Quote: madmatt, you're compiling as C++, not C! Put extern "C" before declaration This helped. chaoscode Quote: in C there was a underscore before the function and thats all. This gave me an idea to remove the underscore from the function name string, and with the above idea, I've managed to get it to compile without error. I'll repost the source In case anybody needs to use it. (thanks to 'vid' for the original 32bit sources , thanks to Fanael and chaoscode also ) [EDIT: correction] Code: ; This is example of mixing C code and assembly ; definitions of macros we use format MS64 COFF include '%fasminc%\win64w.inc' public fasm_rndintq32 as 'fasm_rndintq32' ;extern "C" unsigned int fasm_rndintq32(unsigned int); section '.text' code readable executable ;section '.data' data readable writeable proc fasm_rndintq32 c rndidum:DWORD mov eax, $12345678 ret endp _________________ Gimme a sledge hammer! I'LL FIX IT! |
|||
30 Aug 2009, 20:04 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.