Closed RayKoopa closed 4 years ago
It seems that your project uses a different calling convention than the one that coreclr uses. We use the stdcall calling convention. Could you please try to add __stdcall to the CORECLR_HOSTING_API macro in the coreclrhost.h and see if it fixes the problem?
#define CORECLR_HOSTING_API(function, ...) \
extern "C" int __stdcall function(__VA_ARGS__); \
typedef int (*function##_ptr)(__VA_ARGS__)
I added __stdcall
to CoreClrHost.h
as specified, but the issues remain.
Apparently, my new VC++ project uses __cdecl
, being the default for new projects in VS2017. I changed it to __stdcall
in the project properties, and now it seems to work.
I'm just surprised it doesn't work with the explicit calling convention in the CoreClrHost.h... thanks for the help!
I try to run a .NET Core host from a new project (porting my old COM hosting API code to the newer
CoreClrHost.h
functionality), but when I callcoreclr_initialize_ptr
, it fails with the following Visual Studio message:I can't seem to ignore this message, debugging loops getting access violation exceptions afterwards.
Weirder, I can reproduce this issue with the official SampleHost, but there it seems like I can ignore this message and continue executing the code, just to get the message again at
core_clr_create_delegate
. Is this supposed to happen?If of interest, I steamed down my own code to the following (latest C++ features):
I checked the paths, the loaded library and procedure addresses, they're all correct, only the call at the end fails. Is there anything special I have to set up in my project to make this work?