Hi, the following error occurs, when I wnat to compile my soucce:

ASM-File:
__________________________________________
.386
.MODEL FLAT, STDCALL
OPTION CASEMAP:NONE

INCLUDE Include\WINDOWS.INC
INCLUDE Include\KERNEL32.INC
INCLUDE Include\USER32.INC
INCLUDE Include\MASM32.INC
INCLUDELIB Library\KERNEL32.LIB
INCLUDELIB Library\USER32.LIB
INCLUDELIB Library\MASM32.LIB

.const
dateiname EQU + 8
string EQU + 6

.code
_SchreibeDaten PROC PUBLIC
PUSH EBP
MOV EBP, ESP

INVOKE MessageBox, NULL, ADDR dateiname, ADDR dateiname, NULL
RET 1
_SchreibeDaten ENDP
END
???????????????????????????????????????????????????

CPP-File:
_____________________________________________________
extern NEAR int SchreibeDaten(char c_dateiname, char c_string);
SchreibeDaten("Huhu", "huhuagain");
??????????????????????????????????????????????????????
In the option I add the obj-File fomr the asm-proc.

What could be wrong ?
:confused: :stupid:

Greets FF
Posted on 2003-04-16 10:04:52 by Forginforcer
Posted on 2003-04-16 10:13:52 by bazik
You need some serious help - and you need to read the FAQ section of this board.
linkage of asm+C/C++ - read the FAQ.

furthermore, you don't really seem to know wtf you're doing - "ret 1" ? having your proc after "start:", and "end start" in something that is presumably meant to be linked in as a utility function, not the program body? Using german names for procs and data?

I'd say you're not ready for assembly.
Posted on 2003-04-16 10:16:23 by f0dder
Even though hutch probably thinks people are retards, by using hardcoded paths in masm32 and not allowing you to install to network drive (last time I used the installer anyway), he does have these wise words to say:


MASM32 assumes that the programmers who will use it already have experience in 32 bit Windows API programming using compilers and have done some work in assembler. It is not designed as a beginners package and it does not have the support for beginners to learn the basic concepts about assembler.
Posted on 2003-04-16 10:23:35 by f0dder
I don't really like cdecl , use stdcall



.386
.model flat,stdcall
option casemap:none

include /masm32/include/user32.inc
includelib /masm32/lib/user32.lib
.code
start:

OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
_SchreibeDaten proc
invoke MessageBox, 0, [esp+4],[esp+8],0
leave
retn 4*2
_SchreibeDaten endp
OPTION PROLOGUE:PROLOGUEDEF
OPTION EPILOGUE:EPILOGUEDEF
end start


Hope it works.
Posted on 2003-04-16 10:34:57 by roticv

I don't really like cdecl , use stdcall



.386
.model flat,stdcall
option casemap:none

include /masm32/include/user32.inc
includelib /masm32/lib/user32.lib
.code
start:

OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
_SchreibeDaten proc
invoke MessageBox, 0, [esp+4],[esp+8],0
leave
retn 4*2
_SchreibeDaten endp
OPTION PROLOGUE:PROLOGUEDEF
OPTION EPILOGUE:EPILOGUEDEF
end start


Hope it works.

Remember that function parameters are pushed on the stack so your esp offsets will need to be adjusted. Also, if you don't have a stackframe you don't want 'leave'.

Thomas
Posted on 2003-04-16 10:39:04 by Thomas
I just wunder wich library or dll I have to include.
I already seek aorung, but nothing found.

I did this for 4 years ago and everithing worked fine, but now I have some problems.

Thanks for helping !
Posted on 2003-04-16 10:55:34 by Forginforcer
Remember that function parameters are pushed on the stack so your esp offsets will need to be adjusted. Also, if you don't have a stackframe you don't want 'leave'.


Thanks for informing me. I forgot about the pushs changing the esp and did not know that you do not need leave if I did not have a stackframe.
Posted on 2003-04-16 10:57:43 by roticv
One unresolved function, what can I do ? :confused:
Posted on 2003-04-16 11:02:03 by Forginforcer
extern "C"

Thomas
Posted on 2003-04-16 11:24:04 by Thomas
btw this won't work either:
extern NEAR int SchreibeDaten(char c_dateiname, char c_string);

The chars should be char pointers (char*).

Thomas
Posted on 2003-04-16 11:25:16 by Thomas
I think I have to include a specify library oder dll.
But wich ?
Posted on 2003-04-16 11:41:42 by Forginforcer
No you don't have to, just change it to extern "C" and add *'s to the chars.

Thomas
Posted on 2003-04-16 12:01:07 by Thomas
Hi, I did.
Perhaps its wbecaue I use Visual C++ ?
Posted on 2003-04-16 12:06:15 by Forginforcer
.486

.model flat, stdcall
option casemap:none

include <windows.inc>
include <user32.inc>
includelib <user32.lib>

.code
public SchreibeDaten
SchreibeDaten proc pMsg:dword, pTitle:dword
invoke MessageBox, NULL, pMsg, pTitle, NULL
ret
SchreibeDaten endp
end


extern "C"

{
void __stdcall SchreibeDaten(const char *pMessage, const char *pTitle);
}


Thomas
Posted on 2003-04-16 12:16:22 by Thomas
Hey ultra-thanks ! - Now It works !:grin: :stupid: :stupid: :stupid: :stupid: :stupid:

Thanks a lot !
Posted on 2003-04-16 12:28:40 by Forginforcer