Skip to content

Commit 852efc3

Browse files
committed
From the IeNativeMethods and EdgeNativeMethods classes was removed a explicit calling convention
1 parent ae27bbc commit 852efc3

File tree

2 files changed

+169
-183
lines changed

2 files changed

+169
-183
lines changed

src/MsieJavaScriptEngine/JsRt/Edge/EdgeNativeMethods.cs

Lines changed: 84 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -10,292 +10,285 @@ namespace MsieJavaScriptEngine.JsRt.Edge
1010
/// </summary>
1111
internal static class EdgeNativeMethods
1212
{
13-
#if NETSTANDARD
14-
private const CallingConvention DefaultCallingConvention = CallingConvention.Cdecl;
15-
#else
16-
private const CallingConvention DefaultCallingConvention = CallingConvention.StdCall;
17-
#endif
18-
19-
2013
#region Hosting
2114

22-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention, CharSet = CharSet.Unicode)]
15+
[DllImport(DllName.Chakra, CharSet = CharSet.Unicode)]
2316
internal static extern JsErrorCode JsParseScript(string script, JsSourceContext sourceContext,
2417
string sourceUrl, out EdgeJsValue result);
2518

26-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention, CharSet = CharSet.Unicode)]
19+
[DllImport(DllName.Chakra, CharSet = CharSet.Unicode)]
2720
internal static extern JsErrorCode JsRunScript(string script, JsSourceContext sourceContext,
2821
string sourceUrl, out EdgeJsValue result);
2922

30-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention, CharSet = CharSet.Unicode)]
23+
[DllImport(DllName.Chakra, CharSet = CharSet.Unicode)]
3124
internal static extern JsErrorCode JsSerializeScript(string script, byte[] buffer, ref uint bufferSize);
3225

33-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention, CharSet = CharSet.Unicode)]
26+
[DllImport(DllName.Chakra, CharSet = CharSet.Unicode)]
3427
internal static extern JsErrorCode JsParseSerializedScript(string script, byte[] buffer,
3528
JsSourceContext sourceContext, string sourceUrl, out EdgeJsValue result);
3629

37-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention, CharSet = CharSet.Unicode)]
30+
[DllImport(DllName.Chakra, CharSet = CharSet.Unicode)]
3831
internal static extern JsErrorCode JsRunSerializedScript(string script, byte[] buffer,
3932
JsSourceContext sourceContext, string sourceUrl, out EdgeJsValue result);
4033

41-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention, CharSet = CharSet.Unicode)]
34+
[DllImport(DllName.Chakra, CharSet = CharSet.Unicode)]
4235
internal static extern JsErrorCode JsGetPropertyIdFromName(string name, out EdgeJsPropertyId propertyId);
4336

44-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
37+
[DllImport(DllName.Chakra)]
4538
internal static extern JsErrorCode JsGetPropertyNameFromId(EdgeJsPropertyId propertyId, out IntPtr buffer);
4639

47-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention, CharSet = CharSet.Unicode)]
40+
[DllImport(DllName.Chakra, CharSet = CharSet.Unicode)]
4841
internal static extern JsErrorCode JsPointerToString(string value, UIntPtr stringLength,
4942
out EdgeJsValue stringValue);
5043

51-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
44+
[DllImport(DllName.Chakra)]
5245
internal static extern JsErrorCode JsStringToPointer(EdgeJsValue value, out IntPtr stringValue,
5346
out UIntPtr stringLength);
5447

5548
#endregion
5649

57-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
50+
[DllImport(DllName.Chakra)]
5851
internal static extern JsErrorCode JsCreateRuntime(JsRuntimeAttributes attributes,
5952
JsThreadServiceCallback threadService, out EdgeJsRuntime runtime);
6053

61-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
54+
[DllImport(DllName.Chakra)]
6255
internal static extern JsErrorCode JsCollectGarbage(EdgeJsRuntime handle);
6356

64-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
57+
[DllImport(DllName.Chakra)]
6558
internal static extern JsErrorCode JsDisposeRuntime(EdgeJsRuntime handle);
6659

67-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
60+
[DllImport(DllName.Chakra)]
6861
internal static extern JsErrorCode JsGetRuntimeMemoryUsage(EdgeJsRuntime runtime, out UIntPtr memoryUsage);
6962

70-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
63+
[DllImport(DllName.Chakra)]
7164
internal static extern JsErrorCode JsGetRuntimeMemoryLimit(EdgeJsRuntime runtime, out UIntPtr memoryLimit);
7265

73-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
66+
[DllImport(DllName.Chakra)]
7467
internal static extern JsErrorCode JsSetRuntimeMemoryLimit(EdgeJsRuntime runtime, UIntPtr memoryLimit);
7568

76-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
69+
[DllImport(DllName.Chakra)]
7770
internal static extern JsErrorCode JsSetRuntimeMemoryAllocationCallback(EdgeJsRuntime runtime,
7871
IntPtr callbackState, JsMemoryAllocationCallback allocationCallback);
7972

80-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
73+
[DllImport(DllName.Chakra)]
8174
internal static extern JsErrorCode JsSetRuntimeBeforeCollectCallback(EdgeJsRuntime runtime,
8275
IntPtr callbackState, JsBeforeCollectCallback beforeCollectCallback);
8376

84-
[DllImport(DllName.Chakra, EntryPoint = "JsAddRef", CallingConvention = DefaultCallingConvention)]
77+
[DllImport(DllName.Chakra, EntryPoint = "JsAddRef")]
8578
internal static extern JsErrorCode JsContextAddRef(EdgeJsContext reference, out uint count);
8679

87-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
80+
[DllImport(DllName.Chakra)]
8881
internal static extern JsErrorCode JsAddRef(EdgeJsValue reference, out uint count);
8982

90-
[DllImport(DllName.Chakra, EntryPoint = "JsRelease", CallingConvention = DefaultCallingConvention)]
83+
[DllImport(DllName.Chakra, EntryPoint = "JsRelease")]
9184
internal static extern JsErrorCode JsContextRelease(EdgeJsContext reference, out uint count);
9285

93-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
86+
[DllImport(DllName.Chakra)]
9487
internal static extern JsErrorCode JsRelease(EdgeJsValue reference, out uint count);
9588

96-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
89+
[DllImport(DllName.Chakra)]
9790
internal static extern JsErrorCode JsCreateContext(EdgeJsRuntime runtime, out EdgeJsContext newContext);
9891

99-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
92+
[DllImport(DllName.Chakra)]
10093
internal static extern JsErrorCode JsGetCurrentContext(out EdgeJsContext currentContext);
10194

102-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
95+
[DllImport(DllName.Chakra)]
10396
internal static extern JsErrorCode JsSetCurrentContext(EdgeJsContext context);
10497

105-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
98+
[DllImport(DllName.Chakra)]
10699
internal static extern JsErrorCode JsGetRuntime(EdgeJsContext context, out EdgeJsRuntime runtime);
107100

108-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
101+
[DllImport(DllName.Chakra)]
109102
internal static extern JsErrorCode JsStartDebugging();
110103

111-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
104+
[DllImport(DllName.Chakra)]
112105
internal static extern JsErrorCode JsIdle(out uint nextIdleTick);
113106

114-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
107+
[DllImport(DllName.Chakra)]
115108
internal static extern JsErrorCode JsGetUndefinedValue(out EdgeJsValue undefinedValue);
116109

117-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
110+
[DllImport(DllName.Chakra)]
118111
internal static extern JsErrorCode JsGetNullValue(out EdgeJsValue nullValue);
119112

120-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
113+
[DllImport(DllName.Chakra)]
121114
internal static extern JsErrorCode JsGetTrueValue(out EdgeJsValue trueValue);
122115

123-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
116+
[DllImport(DllName.Chakra)]
124117
internal static extern JsErrorCode JsGetFalseValue(out EdgeJsValue falseValue);
125118

126-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
119+
[DllImport(DllName.Chakra)]
127120
internal static extern JsErrorCode JsBoolToBoolean(bool value, out EdgeJsValue booleanValue);
128121

129-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
122+
[DllImport(DllName.Chakra)]
130123
internal static extern JsErrorCode JsBooleanToBool(EdgeJsValue booleanValue, out bool boolValue);
131124

132-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
125+
[DllImport(DllName.Chakra)]
133126
internal static extern JsErrorCode JsConvertValueToBoolean(EdgeJsValue value, out EdgeJsValue booleanValue);
134127

135-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
128+
[DllImport(DllName.Chakra)]
136129
internal static extern JsErrorCode JsGetValueType(EdgeJsValue value, out JsValueType type);
137130

138-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
131+
[DllImport(DllName.Chakra)]
139132
internal static extern JsErrorCode JsDoubleToNumber(double doubleValue, out EdgeJsValue value);
140133

141-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
134+
[DllImport(DllName.Chakra)]
142135
internal static extern JsErrorCode JsIntToNumber(int intValue, out EdgeJsValue value);
143136

144-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
137+
[DllImport(DllName.Chakra)]
145138
internal static extern JsErrorCode JsNumberToDouble(EdgeJsValue value, out double doubleValue);
146139

147-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
140+
[DllImport(DllName.Chakra)]
148141
internal static extern JsErrorCode JsNumberToInt(EdgeJsValue value, out int intValue);
149142

150-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
143+
[DllImport(DllName.Chakra)]
151144
internal static extern JsErrorCode JsConvertValueToNumber(EdgeJsValue value, out EdgeJsValue numberValue);
152145

153-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
146+
[DllImport(DllName.Chakra)]
154147
internal static extern JsErrorCode JsGetStringLength(EdgeJsValue sringValue, out int length);
155148

156-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
149+
[DllImport(DllName.Chakra)]
157150
internal static extern JsErrorCode JsConvertValueToString(EdgeJsValue value, out EdgeJsValue stringValue);
158151
#if !NETSTANDARD
159152

160-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
153+
[DllImport(DllName.Chakra)]
161154
internal static extern JsErrorCode JsVariantToValue([MarshalAs(UnmanagedType.Struct)] ref object var,
162155
out EdgeJsValue value);
163156

164-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
157+
[DllImport(DllName.Chakra)]
165158
internal static extern JsErrorCode JsValueToVariant(EdgeJsValue obj,
166159
[MarshalAs(UnmanagedType.Struct)] out object var);
167160
#endif
168161

169-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
162+
[DllImport(DllName.Chakra)]
170163
internal static extern JsErrorCode JsGetGlobalObject(out EdgeJsValue globalObject);
171164

172-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
165+
[DllImport(DllName.Chakra)]
173166
internal static extern JsErrorCode JsCreateObject(out EdgeJsValue obj);
174167

175-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
168+
[DllImport(DllName.Chakra)]
176169
internal static extern JsErrorCode JsCreateExternalObject(IntPtr data,
177170
JsObjectFinalizeCallback finalizeCallback, out EdgeJsValue obj);
178171

179-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
172+
[DllImport(DllName.Chakra)]
180173
internal static extern JsErrorCode JsConvertValueToObject(EdgeJsValue value, out EdgeJsValue obj);
181174

182-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
175+
[DllImport(DllName.Chakra)]
183176
internal static extern JsErrorCode JsGetPrototype(EdgeJsValue obj, out EdgeJsValue prototypeObject);
184177

185-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
178+
[DllImport(DllName.Chakra)]
186179
internal static extern JsErrorCode JsSetPrototype(EdgeJsValue obj, EdgeJsValue prototypeObject);
187180

188-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
181+
[DllImport(DllName.Chakra)]
189182
internal static extern JsErrorCode JsGetExtensionAllowed(EdgeJsValue obj, out bool value);
190183

191-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
184+
[DllImport(DllName.Chakra)]
192185
internal static extern JsErrorCode JsPreventExtension(EdgeJsValue obj);
193186

194-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
187+
[DllImport(DllName.Chakra)]
195188
internal static extern JsErrorCode JsGetProperty(EdgeJsValue obj, EdgeJsPropertyId propertyId,
196189
out EdgeJsValue value);
197190

198-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
191+
[DllImport(DllName.Chakra)]
199192
internal static extern JsErrorCode JsGetOwnPropertyDescriptor(EdgeJsValue obj, EdgeJsPropertyId propertyId,
200193
out EdgeJsValue propertyDescriptor);
201194

202-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
195+
[DllImport(DllName.Chakra)]
203196
internal static extern JsErrorCode JsGetOwnPropertyNames(EdgeJsValue obj, out EdgeJsValue propertyNames);
204197

205-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
198+
[DllImport(DllName.Chakra)]
206199
internal static extern JsErrorCode JsSetProperty(EdgeJsValue obj, EdgeJsPropertyId propertyId,
207200
EdgeJsValue value, bool useStrictRules);
208201

209-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
202+
[DllImport(DllName.Chakra)]
210203
internal static extern JsErrorCode JsHasProperty(EdgeJsValue obj, EdgeJsPropertyId propertyId,
211204
out bool hasProperty);
212205

213-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
206+
[DllImport(DllName.Chakra)]
214207
internal static extern JsErrorCode JsDeleteProperty(EdgeJsValue obj, EdgeJsPropertyId propertyId,
215208
bool useStrictRules, out EdgeJsValue result);
216209

217-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
210+
[DllImport(DllName.Chakra)]
218211
internal static extern JsErrorCode JsDefineProperty(EdgeJsValue obj, EdgeJsPropertyId propertyId,
219212
EdgeJsValue propertyDescriptor, out bool result);
220213

221-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
214+
[DllImport(DllName.Chakra)]
222215
internal static extern JsErrorCode JsHasIndexedProperty(EdgeJsValue obj, EdgeJsValue index, out bool result);
223216

224-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
217+
[DllImport(DllName.Chakra)]
225218
internal static extern JsErrorCode JsGetIndexedProperty(EdgeJsValue obj, EdgeJsValue index,
226219
out EdgeJsValue result);
227220

228-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
221+
[DllImport(DllName.Chakra)]
229222
internal static extern JsErrorCode JsSetIndexedProperty(EdgeJsValue obj, EdgeJsValue index,
230223
EdgeJsValue value);
231224

232-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
225+
[DllImport(DllName.Chakra)]
233226
internal static extern JsErrorCode JsDeleteIndexedProperty(EdgeJsValue obj, EdgeJsValue index);
234227

235-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
228+
[DllImport(DllName.Chakra)]
236229
internal static extern JsErrorCode JsEquals(EdgeJsValue obj1, EdgeJsValue obj2, out bool result);
237230

238-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
231+
[DllImport(DllName.Chakra)]
239232
internal static extern JsErrorCode JsStrictEquals(EdgeJsValue obj1, EdgeJsValue obj2, out bool result);
240233

241-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
234+
[DllImport(DllName.Chakra)]
242235
internal static extern JsErrorCode JsHasExternalData(EdgeJsValue obj, out bool value);
243236

244-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
237+
[DllImport(DllName.Chakra)]
245238
internal static extern JsErrorCode JsGetExternalData(EdgeJsValue obj, out IntPtr externalData);
246239

247-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
240+
[DllImport(DllName.Chakra)]
248241
internal static extern JsErrorCode JsSetExternalData(EdgeJsValue obj, IntPtr externalData);
249242

250-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
243+
[DllImport(DllName.Chakra)]
251244
internal static extern JsErrorCode JsCreateArray(uint length, out EdgeJsValue result);
252245

253-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
246+
[DllImport(DllName.Chakra)]
254247
internal static extern JsErrorCode JsCallFunction(EdgeJsValue function, EdgeJsValue[] arguments,
255248
ushort argumentCount, out EdgeJsValue result);
256249

257-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
250+
[DllImport(DllName.Chakra)]
258251
internal static extern JsErrorCode JsConstructObject(EdgeJsValue function, EdgeJsValue[] arguments,
259252
ushort argumentCount, out EdgeJsValue result);
260253

261-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
254+
[DllImport(DllName.Chakra)]
262255
internal static extern JsErrorCode JsCreateFunction(EdgeJsNativeFunction nativeFunction,
263256
IntPtr externalData, out EdgeJsValue function);
264257

265-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
258+
[DllImport(DllName.Chakra)]
266259
internal static extern JsErrorCode JsCreateError(EdgeJsValue message, out EdgeJsValue error);
267260

268-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
261+
[DllImport(DllName.Chakra)]
269262
internal static extern JsErrorCode JsCreateRangeError(EdgeJsValue message, out EdgeJsValue error);
270263

271-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
264+
[DllImport(DllName.Chakra)]
272265
internal static extern JsErrorCode JsCreateReferenceError(EdgeJsValue message, out EdgeJsValue error);
273266

274-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
267+
[DllImport(DllName.Chakra)]
275268
internal static extern JsErrorCode JsCreateSyntaxError(EdgeJsValue message, out EdgeJsValue error);
276269

277-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
270+
[DllImport(DllName.Chakra)]
278271
internal static extern JsErrorCode JsCreateTypeError(EdgeJsValue message, out EdgeJsValue error);
279272

280-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
273+
[DllImport(DllName.Chakra)]
281274
internal static extern JsErrorCode JsCreateURIError(EdgeJsValue message, out EdgeJsValue error);
282275

283-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
276+
[DllImport(DllName.Chakra)]
284277
internal static extern JsErrorCode JsHasException(out bool hasException);
285278

286-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
279+
[DllImport(DllName.Chakra)]
287280
internal static extern JsErrorCode JsGetAndClearException(out EdgeJsValue exception);
288281

289-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
282+
[DllImport(DllName.Chakra)]
290283
internal static extern JsErrorCode JsSetException(EdgeJsValue exception);
291284

292-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
285+
[DllImport(DllName.Chakra)]
293286
internal static extern JsErrorCode JsDisableRuntimeExecution(EdgeJsRuntime runtime);
294287

295-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
288+
[DllImport(DllName.Chakra)]
296289
internal static extern JsErrorCode JsEnableRuntimeExecution(EdgeJsRuntime runtime);
297290

298-
[DllImport(DllName.Chakra, CallingConvention = DefaultCallingConvention)]
291+
[DllImport(DllName.Chakra)]
299292
internal static extern JsErrorCode JsIsRuntimeExecutionDisabled(EdgeJsRuntime runtime, out bool isDisabled);
300293
}
301294
}

0 commit comments

Comments
 (0)