1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <string.h>
8#include <xplatform.h>
9
10typedef struct TLPStr_Test_Struct
11{
12 LPSTR pStr;
13} LPStr_Test_Struct;
14
15typedef struct TLPStr_Test_Class
16{
17 LPSTR pStr;
18} LPStr_Test_Class;
19
20typedef struct TLPStrTestStructOfArrays
21{
22 LPSTR pStr1;
23 LPSTR pStr2;
24} LPStrTestStructOfArrays;
25
26extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_In_String(LPSTR pStr)
27{
28 printf ("xx %s \n", pStr);
29
30 return TRUE;
31}
32
33extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InByRef_String(LPSTR* ppStr)
34{
35 printf ("yy %s \n", *ppStr);
36
37 return TRUE;
38}
39
40extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InOutByRef_String(LPSTR* ppStr)
41{
42 printf ("zz %s \n", *ppStr);
43
44 return TRUE;
45}
46
47extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_In_StringBuilder(LPSTR pStr)
48{
49 return TRUE;
50}
51
52extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InByRef_StringBuilder(LPSTR* ppStr)
53{
54 return TRUE;
55}
56
57extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InOutByRef_StringBuilder(LPSTR* ppStr)
58{
59 return TRUE;
60}
61
62extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_In_Struct_String (LPStr_Test_Struct strStruct)
63{
64 return TRUE;
65}
66
67extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InByRef_Struct_String (LPStr_Test_Struct* pSstrStruct)
68{
69 return TRUE;
70}
71
72extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InOutByRef_Struct_String (LPStr_Test_Struct* pStrStruct)
73{
74 return TRUE;
75}
76
77extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_In_Array_String (LPSTR str[])
78{
79 printf ("%s \n", str[0]);
80 printf ("%s \n", str[1]);
81 printf ("%s \n", str[2]);
82
83 return TRUE;
84}
85
86extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InByRef_Array_String (LPSTR* str[])
87{
88 printf ("%s \n", (*str)[0]);
89 printf ("%s \n", (*str)[1]);
90 printf ("%s \n", (*str)[2]);
91
92 return TRUE;
93}
94
95extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InOutByRef_Array_String (LPSTR* str[])
96{
97 printf ("%s \n", (*str)[0]);
98 printf ("%s \n", (*str)[1]);
99 printf ("%s \n", (*str)[2]);
100
101 return TRUE;
102}
103
104extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_In_Class_String (LPStr_Test_Class strClass)
105{
106 return TRUE;
107}
108
109extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InByRef_Class_String (LPStr_Test_Class* pSstrClass)
110{
111 return TRUE;
112}
113
114extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InOutByRef_Class_String (LPStr_Test_Class* pStrClass)
115{
116 return TRUE;
117}
118
119extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_In_Array_Struct (LPStr_Test_Struct str[])
120{
121 printf ("** %s \n", str[0].pStr);
122 printf ("** %s \n", str[1].pStr);
123
124 return TRUE;
125}
126
127extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InByRef_Array_Struct (LPStr_Test_Struct* str[])
128{
129 printf ("++ %s \n", (*str)[0].pStr);
130 printf ("++ %s \n", (*str)[1].pStr);
131
132 return TRUE;
133}
134
135extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_InOutByRef_Array_Struct (LPStr_Test_Struct* str[])
136{
137 printf ("-- %s \n", (*str)[0].pStr);
138 printf ("-- %s \n", (*str)[1].pStr);
139
140 return TRUE;
141}
142
143extern "C" bool DLL_EXPORT STDMETHODCALLTYPE LPStrBuffer_In_Struct_String_nothrow (LPStr_Test_Struct strStruct)
144{
145 return TRUE;
146}
147