Tamas Pocker
02-11-2006, 07:13 PM
Hi all!
Iam a new guy to the driver development, and I have some problems at the beginning. If I want to compile my .c file with ntddk.h included, the compile process always finishes with syntax error! I tried everything I could but I dont really know whats the real problem...
Please, can u help me?
Here is the error:
driv.c
d:\WINDDK\ntddk.h(10640) : error C2061: syntax error : identifier 'PCONTEXT'
d:\WINDDK\ntddk.h(10641) : error C2059: syntax error : '}'
d:\WINDDK\ntddk.h(11584) : fatal error C1189: #error : "no target architecture
rileyq
02-14-2006, 11:19 PM
In my old compiler I first saved to a .cpp file then to an .obj file then finally to the .exe file. Don't know that you have these steps in Visual Basic or Visual Studio; but syntax can't be the problem if you get past the .c or .cpp stage.
Are you sure your library has the ntddk.h included? Or have you checked the ntddk.h file for errors in itself; for indeed it sounds as if the error is not in your code other than including <ntddk.h> which when called then produces the syntax error. Either check out ntddk.h or reinstall a new file. See if that works.
rileyq
02-17-2006, 12:36 AM
Actually I miswrote on my last post: if you can compile to the .obj then the problem is not your code.
Does your IDE (independent design enviornment) require you to link your compiled code or provide for this being done; this might be another issue.
Unregistered
02-25-2006, 08:38 PM
I also considered another issue. It would not be relevant most places but here at this driver site it may be.
First out if your IDE is not allowing you to compile code (that you have reviewed and found correct) then maybe your IDE and it's .h file are telling you something.
For example if you are writing code on a 64 bit Itanium or K64 with a 32 bit IDE and trying to make drivers for people using 32 bit computers then the problem might be in the standard variable lengths on your computer compared to those available in the 32 bit world. Problems of course are worse if you are trying to write drivers for people in 16 bit or even 8 bit or earlier world (which I doubt).
This all depends on your code and your use of numbers. But maybe you cannot use the standard variable lengths on your computer for writing the code you are trying to write. The work around would seem to define special variables[short, long, float, char, double] of appropriate length and then to specify these in all your code.
Alternatively you could use a 32 bit computer to run your 32 bit IDE and then everything would be alright as far as variable length is concerned (of course assuming again that a later 32 bit computer has the same variable length as an earlier 32 bit computer--which is not guaranteed.) Generally though this would be handled by the limitations of the OS software and IDE software.
If you are thinking of writing for the 16 bit world, I doubt that you could load (or maybe even find) a 16 bit IDE on a 64 bit computer. In that case you could still perhaps define special variable lengths but this would so limit the code lengths it would probably cause you a problem. Even for graphics you could not use normal font and display drivers since newer fonts would have much more code to allow for the numerous sizes, resolutions, and even colors that a 64 bit computer could provide. All such resolutions, degrees, and specifications would be so limited as to amaze you. This of course explains some of the story about the inflation in code weight that has occured as computers have become more powerful. To think that you could load a graphical interface back in the 16 bit or 12 bit world with a hard disk of 42 mgs and 4 mgs of RAM is a bit astonishing; but it did happen. Even early Windows NT needed a very small amount of disk space to load. In fact inflation in code is in part caused by the better resolutions provided by larger bit sizes.
But in reality one knows that in the 32 bit world not all the numbers available in the binary code have even been given functions or resolutions, sizes, colors, positions, dimensions, speeds, or some other 'division'. That in fact was why Intel introduced MMX, badmouthed by most programmers. But consider Intel's concern from using hex numbers and so outrunning the 'density' of the binary code of programmers and finding that those small code binary programmers didn't even use all the numbers in base 2! Not only that, Intel not only runs hex numbers but also internally runs 64 bit on some chips and through some boards. Of course they always have to have more numbers available than those available to the OS and applications and drivers writers so that they can accomodate both the upper level software and the basic processor functions and board functions. But then to C programmers and Visual Basic and Visual Studio the sand makers hex assembler code is cryptic stone age code.
Tamas Pocker
02-27-2006, 07:05 PM
Hi!
Thanks, very nice post (and very long)! :-)))
I use simple 32 bit technology with windows xp.
I've installed Visual Studio 6 but its not compatible with the windows ddk.
So I tried to compile my source code with the ddk's built in compiler.
If I have only this code:
#include <ntddk.h>
int main()
{
return 0;
}
the problem is the same... So, I dont know...
One thing is sure, the problem is not in my code i guess.
Can u tell me which os, ddk & sdk do you use? Maybe I'll have to reinstall my system!
Thanks a lot!
Bye!
Ammar_j
05-07-2006, 11:41 AM
Dear,
the problem is not your code, this is for sure, and for your astonishing there is no problem!. I am a driver writer and I share you the same problem and I am working to solve it, I got some success in the way I am heading to the solution. the real problem is your compiler need to be informed about the target maching you want to generate code for, this can be accomplish by make some #define for some value to guid the compiler.
for example you must define IOCTL_INTERFACE in your sources file to include the IOCTL interface support.
I will send you any updates and I would like to ask you the same.
Unregistered
05-08-2006, 11:46 AM
Dear,
I found the solution, just put the following at the beginning of your code
#define _X86_
.
.
.
your code
best regards
Ammar Jabbar
Hi!
Thanks, very nice post (and very long)! :-)))
I use simple 32 bit technology with windows xp.
I've installed Visual Studio 6 but its not compatible with the windows ddk.
So I tried to compile my source code with the ddk's built in compiler.
If I have only this code:
#include <ntddk.h>
int main()
{
return 0;
}
the problem is the same... So, I dont know...
One thing is sure, the problem is not in my code i guess.
Can u tell me which os, ddk & sdk do you use? Maybe I'll have to reinstall my system!
Thanks a lot!
Bye!