I am writing windows functions in assembly language for use in c++ programs, but I can't figure out how to pass parameters from the c++ code to the assembly code. The assembly when assembled and linked runs fine, but when I tried to use the function in c++ it said missing storage-class or type specifiers. The value I'm trying to pass is a string and in the assembly code I have it as a dword, but there has to be a remedy to this...
Posted on 2002-03-02 22:49:07 by sleex
Most of these generic questions could best be answered by doing a search of this board...

If it isn't generic it would help facilitate the answering of your question by giving the source (or part of it) so we can debug it...

Since i have not much to work with -- I just did a search for you and found another generic post where "how do i call assembly procedures in c++" was answered

click here for that thread
Posted on 2002-03-02 23:18:15 by Sliver
Since this is a guessing game, can we assume that you are correctly passing a pointer to the string, or using the '&' operator to pass its address?
Posted on 2002-03-03 03:31:21 by sluggy
First I told you exactly what I am doing, and told you the debugger error. Yes I'm using the & operator. Okay you want to see the code? Here it is:

MakeWin((unsigned int)&string);

in assembly:
MakeWin PROTO string:DWORD
Posted on 2002-03-03 08:09:01 by sleex
When you declared MakeWin prototype did you make this:

void _stdcall MakeWin(char * str);

The _stdcall is the important part here. Because otherwise the calling conversion will default to _cdecl.

then when you do something like:

char * strTest = "This is a Test";



You will be fine. Note that I use strTest and not &strTest this is because what you want is a pointer to a string and not a pointer to a pointer to a string.

I would advice not to use string as a variable name, since there is a template called string in the C++ STL. This could cause confution on the long run.
Posted on 2002-03-03 08:31:12 by dxantos