|
1 |
| - |
2 | 1 | // <Snippet1>
|
3 | 2 | using namespace System;
|
4 | 3 | using namespace System::Runtime::InteropServices;
|
5 |
| -public ref class LibWrap |
| 4 | + |
| 5 | +private ref class NativeMethods |
6 | 6 | {
|
7 | 7 | public:
|
8 | 8 |
|
9 |
| - // CallingConvention.Cdecl must be used since the stack is |
10 |
| - // cleaned up by the caller. |
11 |
| - // int printf( const char *format [, argument]... ) |
| 9 | + // CallingConvention.Cdecl must be used since the stack is |
| 10 | + // cleaned up by the caller. |
| 11 | + // int printf( const char *format [, argument]... ) |
12 | 12 |
|
13 |
| - [DllImport("msvcrt.dll",CharSet=CharSet::Unicode, CallingConvention=CallingConvention::Cdecl)] |
14 |
| - static int printf( String^ format, int i, double d ); |
| 13 | + [DllImport("msvcrt.dll", CharSet = CharSet::Unicode, CallingConvention = CallingConvention::Cdecl)] |
| 14 | + static int printf(String^ format, int i, double d); |
15 | 15 |
|
16 |
| - [DllImport("msvcrt.dll",CharSet=CharSet::Unicode, CallingConvention=CallingConvention::Cdecl)] |
17 |
| - static int printf( String^ format, int i, String^ s ); |
| 16 | + [DllImport("msvcrt.dll", CharSet = CharSet::Unicode, CallingConvention = CallingConvention::Cdecl)] |
| 17 | + static int printf(String^ format, int i, String^ s); |
18 | 18 | };
|
19 | 19 |
|
20 | 20 | int main()
|
21 | 21 | {
|
22 |
| - LibWrap::printf( "\nPrint params: %i %f", 99, 99.99 ); |
23 |
| - LibWrap::printf( "\nPrint params: %i %s", 99, "abcd" ); |
| 22 | + NativeMethods::printf("\nPrint params: %i %f", 99, 99.99); |
| 23 | + NativeMethods::printf("\nPrint params: %i %s", 99, "abcd"); |
24 | 24 | }
|
25 |
| - |
26 | 25 | // </Snippet1>
|
0 commit comments