Re: RPC Example from MSDN
From MSDN on the C1189 error.....
Quote:
You may also see this error if you build an ATL project with the /robust MIDL compiler option. /robust is only for use when building for a Windows 2000 or later machine. So, either remove /robust or change this line in the dlldatax.c file:
#define _WIN32_WINNT 0x0400 //for WinNT 4.0 or Win95 with DCOM
to
#define _WIN32_WINNT 0x0500 //for WinNT 4.0 or Win95 with DCOM
For the LNK2001 error....
This may help for the _WinMain part of the error
Quote:
When building a Release version of an ATL project, indicates that CRT startup code is required. To fix, do one of the following,
Remove _ATL_MIN_CRT from the list of preprocessor defines to allow CRT startup code to be included. See General Configuration Settings Property Page for more information.
For the _hello_ServerIfHandle part of the error.....
Make sure sure the .h and .c/.cpp file that contains this function/method is part of the VC++ project so the linker can find the appropriate object files.
HTH
1 Attachment(s)
Re: RPC Example from MSDN
f1shrman
Thank you very much for the reply.
You pointed very nicely but still i am unable to solve the problem.
I looked for the
#define _WIN32_WINNT 0x0400 //for WinNT 4.0 or Win95 with DCOM
in dlldatax.c
but unfortunately there is no such file in my project.
As there is the concern of _hello_ServerIfHandle i added the idl file and also the .h generated file from MIDL compiler but still the problem remains there.
As i am trying to compile and run the MSDN project in visual studio. I generated the _c.c _s.c and .h using MIDL compiler on command line and then i added these files in the visualstudio project.
Can you please do it for me. I am attaching the project files with the post.
1 Attachment(s)
Re: RPC Example from MSDN
I dug up the sample in the sdk and from the readme - ran nmake - and everything compiled correctly - here are the results. You might try running nmake cleanall then recompiling
Re: RPC Example from MSDN
f1shrman
Thank you for spending time for me.
Dear i can compile ane execute the program using nmake on command line.
But i want to inject that code in my another application. So when i try this program in MS VisualStudio 6.0 I face the last mentioned problems. Can you compile and execute this project in the MS VisualStudio 6 ?
Waiting for your reply
Thanks alot
Re: RPC Example from MSDN
I spent some time looking at this today and did not come up with a solution. I tried various MIDL commandline options - had some luck with /app_config Hello.Acf to get the interfaces set - this got rid of the _hello_ServerIfHandle related error - you will have to change the function name to what ever the compiler creates - i.e. _hello_my_p_handle.
I was not able to get rid of the C1189 error, but I did a lot of looking at things........
From the Win32 API:
Quote:
BOOL DeleteFile()
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
So based on this I take that BOOL TRUE is non zero and BOOL FALSE is zero
From MSDN:
Quote:
When a postfix or prefix ++ operator is applied to a variable of type bool, the variable is set to true. The postfix or prefix -- operator cannot be applied to a variable of this type.
The bool type participates in integral promotions. An r-value of type bool can be converted to an r-value of type int, with false becoming zero and true becoming one. As a distinct type, bool participates in overload resolution.
So based on this I take that bool true can be a non zero value and bool false can be zero. Even though you should probably not use an integer to check for bool true or false - it can be done.
In RpcNdr.h
Code:
#if (0x500 <= _WIN32_WINNT)
#define TARGET_IS_NT50_OR_LATER 1
#else
#define TARGET_IS_NT50_OR_LATER 0
#endif
On an XP and Win2k box, this fails with fatal error C1189: #error : You need a Windows 2000 or later to run this stub because it uses these features:
If you change RpcNdr.h to match the BOOL or bool definition above.
Code:
#if (0x500 <= _WIN32_WINNT)
#define TARGET_IS_NT50_OR_LATER 0 // 1
#else
#define TARGET_IS_NT50_OR_LATER 1 // 0
#endif
On the same XP and Win2k box, the C1189 error goes away.
The check in the _c file is
Code:
#if !(TARGET_IS_NT50_OR_LATER)
What am I missing?
Re: RPC Example from MSDN
f1shrman
Thank you very much
that you spent time over it.
I am trying my best to solve this issue. But if in the mean time you can get some solution please post it.
Once again thankyou very much
Re: RPC Example from MSDN
I am able to comiple and execute the above project in visualstudio 6.
Here are the steps
1, Put the extension .mak to the makefile (makefile -> makefile.mak)
2, Open it in the visualstudio (Create a project)
3, Add the .h and .c/.cpp files
4, Compile / Execute
Re: RPC Example from MSDN
If you are still having troubles, try this; Put back everything as was and remove the rpcndr.lib from the link inputs in the p/s make file(*.mak,*.mk). This file(rpcndr.lib) is vestigal and is not needed any more to link with the SDK you probably have. Cheers.
Re: RPC Example from MSDN
Please note that this thread has been dead since 2004... ;)
Re: RPC Example from MSDN
gcam1964,
Thank you dear but some one could not wait that much for the issues.
Time is money.
Regards,