Mixing C and assembly

Is there a simple example of someone doing this with ml64 and Visual Studio 2010?
I can't really remember how multi-module assembly was supposed to be done.

I started sloooow just to see how it should be done.

So, according to my memories if you wanted a proc to be seen from outside you needed to declare it global, like this
1
2
3
4
5
6
7
8
9
10
11
global _test

.CODE

    _test PROC

	ret ; right back to you, C

    _test ENDP

END


But ml64 complains that global is a syntax error. Remove that and it does his job, so that's my only problem for now.

Assuming I get this right, how should my C source look in Visual Studio 2010 in order to work with this?

Side-question: I was expecting some "external dependencies" options in Project Proprieties | Linker were I should add my other *.obj files so the linker will see and add them to final product, but I can't find that either.

I guess what I'm asking for is a beginner's guide for how to make Visual Studio work with assembly written files (making procedures and data visible from one file to another).

Also, more of a curiosity: why isn't inline assembly allowed in x64 builds? I'm so used to just __asm {} my way through life that I completely forgot how to do it any other way.

I'm working on a DLL it this makes any difference.

Ok, this is embarrassing:
1
2
3
.CODE
    _test PROC GLOBAL
- snip -

seems to be to correct syntax. But my questions are still the same.
Last edited on
closed account (13bSLyTq)
Yes, These are tutorials of inline x64 Assembly plus C++: https://www.youtube.com/playlist?list=PL0C5C980A28FEE68D

I don't really understand your question however I thought this may help give an viable solution.
Last edited on
Topic archived. No new replies allowed.