Thread: [Dev-C++] inline assembly in winnt.h
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Thoralf S. <tho...@ya...> - 2005-06-24 09:03:06
|
Hi there, I hope this is the right place to ask this question - I've been searching both the archive and the web, to no avail ... I'm just trying to compile a project (GEM for Pure Data, CVS version, see http://gem.iem.at/download.html#CVS) that involves some DirectShow stuff. Of course, a bunch of M$ libraries is needed for this, and Dev-C++ (or, for that matter, MinGW or g++) chokes on some inline assembly in winnt.h (lines 588 ff.), which is part of the MS Platform SDK. Here's the relevant code: #if _MSC_VER >= 1200 #pragma warning(push) #endif #pragma warning(disable:4035 4793) // re-enable below __inline ULONGLONG NTAPI Int64ShllMod32 ( ULONGLONG Value, DWORD ShiftCount ) { __asm { mov ecx, ShiftCount mov eax, dword ptr [Value] mov edx, dword ptr [Value+4] shld edx, eax, cl shl eax, cl } } and the error messages: make.exe -f "D:\Dokumente und Einstellungen\VJ\Eigene Dateien\GEM\Gem\src\Makefile.win" all g++.exe -c Pixes/DSgrabber.cpp -o Pixes/DSgrabber.o -I"." -I"./Base" -I"../../pd/src" -I"../../GemLibs/freetype2/include" -I"../../GemLibs/tiff/libtiff" -I"../../GemLibs/JPEG" -I"../../GemLibs/wintab/include" -I"../../GemLibs/FTGL/include" -I"D:/Programme/Microsoft Platform SDK/Samples/Multimedia/DirectShow/BaseClasses" -I"D:/Programme/Microsoft DirectX 9.0 SDK (February 2005)/Include" -I"D:/Programme/Microsoft Platform SDK/Include" -D__GNUWIN32__ -mcpu=pentiumpro -D_M_IX86=600 -W -finline-functions -DNDEBUG -DWIN32 -D_WINDOWS -DNT -D_LANGUAGE_C_PLUS_PLUS -DWIN32_LEAN_AND_MEAN -DGEM_INTERNAL -O2 -march=i686 -msse In file included from D:/Programme/Microsoft Platform SDK/Include/windef.h:176, from d:/programme/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/excpt.h:20, from D:/Programme/Microsoft Platform SDK/Include/windows.h:157, from D:/Programme/Microsoft Platform SDK/Samples/Multimedia/DirectShow/BaseClasses/streams.h:41, from Pixes/DSgrabber.cpp:13: D:/Programme/Microsoft Platform SDK/Include/winnt.h: In function `ULONGLONG Int64ShllMod32(ULONGLONG, DWORD)': D:/Programme/Microsoft Platform SDK/Include/winnt.h:588: error: expected `(' before '{' token D:/Programme/Microsoft Platform SDK/Include/winnt.h:588: error: expected asm body before '{' token D:/Programme/Microsoft Platform SDK/Include/winnt.h:589: error: `mov' undeclared (first use this function) D:/Programme/Microsoft Platform SDK/Include/winnt.h:589: error: (Each undeclared identifier is reported only once for each function it appears in.) D:/Programme/Microsoft Platform SDK/Include/winnt.h:589: error: expected `;' before "ecx" D:/Programme/Microsoft Platform SDK/Include/winnt.h: In function `LONGLONG Int64ShraMod32(LONGLONG, DWORD)': D:/Programme/Microsoft Platform SDK/Include/winnt.h:604: error: expected `(' before '{' token D:/Programme/Microsoft Platform SDK/Include/winnt.h:604: error: expected asm body before '{' token D:/Programme/Microsoft Platform SDK/Include/winnt.h:605: error: `mov' undeclared (first use this function) D:/Programme/Microsoft Platform SDK/Include/winnt.h:605: error: expected `;' before "ecx" It would be really great if someone could shed some light on this ... many thanks in advance, Thoralf. ___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com |
|
From: Alfred P. R. <al...@ya...> - 2005-06-24 16:23:57
|
Hi Thoralf,
Possibly a missing semi-colon?
Try:
DWORD ShiftCount
);
Instead of
DWORD ShiftCount
)
I'm basing that on the first error, and the complaints of missing ";". Possibly a problem with the formatting of Int64ShllMod32 parameters?
Thoralf Schulze <tho...@ya...> wrote:
Hi there,
I hope this is the right place to ask this question -
I've been searching both the archive and the web, to
no avail ...
I'm just trying to compile a project (GEM for Pure
Data, CVS version, see
http://gem.iem.at/download.html#CVS) that involves
some DirectShow stuff. Of course, a bunch of M$
libraries is needed for this, and Dev-C++ (or, for
that matter, MinGW or g++) chokes on some inline
assembly in winnt.h (lines 588 ff.), which is part of
the MS Platform SDK.
Here's the relevant code:
#if _MSC_VER >= 1200
#pragma warning(push)
#endif
#pragma warning(disable:4035 4793) //
re-enable below
__inline ULONGLONG
NTAPI
Int64ShllMod32 (
ULONGLONG Value,
DWORD ShiftCount
)
{
__asm {
mov ecx, ShiftCount
mov eax, dword ptr [Value]
mov edx, dword ptr [Value+4]
shld edx, eax, cl
shl eax, cl
}
}
and the error messages:
<snip>
D:/Programme/Microsoft Platform SDK/Include/winnt.h:588: error: expected `(' before
'{' token
D:/Programme/Microsoft Platform SDK/Include/winnt.h:588: error: expected asm body before '{' token
D:/Programme/Microsoft Platform SDK/Include/winnt.h:589: error: `mov' undeclared
(first use this function)
D:/Programme/Microsoft Platform SDK/Include/winnt.h:589: error: (Each undeclared
identifier is reported only once for each function it appears in.)
D:/Programme/Microsoft Platform SDK/Include/winnt.h:589: error: expected `;' before
"ecx"
<snip>
Alfred P. Reaud
|
|
From: Lord S. <lor...@gm...> - 2005-07-06 17:29:23
|
How to use assembly with Dev-C++ ?
The "GNU as" assembler uses AT&T syntax (not Intel).
Here's an example of such a syntax :
// 2 global variables
int AdrIO;
static char ValIO;
void MyFunction(..........)
{
__asm("mov _AdrIO, %dx") ; // loading 16 bits register
__asm("mov _ValIO, %al") ; // loading 8 bits register
/*
Don't forget the underscore _ before each global variable names !
*/
__asm("mov %ax,%dx") ; // AX --> DX
}
That is quoted directly from the DevC++ help files.
I think that's what you're talking about, but just for clairity in our
archives, I'd like to post that (since I refer back to this stuff quite
often)
Sorry if someone already said that - I'm a bit bleary-eyed right now at 2300
at night ;) (my laptop's not connected right now, so I'm using the "send
later" button in Outlook Express - so if the message is postmarked
differently, I'm not off my rocker - yet)
Happy coding and may the Force be with you!
|