Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

c# - Does a CLR Class Library have to be run in Win32?

I created a CLR project in VS2017.

Included:

  • CLR Class Library(C++) .NET Framework 4.5
  • C# ConsoleApp

There is a simple ref class defined in the Library. The class is called from my C# code. I am fine with its performance but it does not work always.

It depends on how I run it.

  • "Debug" and "x86" works
  • "Debug" and "x64" does not work
  • "Release" and "x86" works
  • "Release" and "x64" does not work

So in Debug and Release it only works when the CLR Class Library is run in Win32.

Do I make a mistake or is this intended behaviour?

Thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Usually the purpose of using C++/CLI language (I assume that's what you mean by "CLR Library") is to use both native and .Net objects. Because of native code, the binary library is tied to either 32-bit or 64-bit platform. Apparently, in your case, this is 32-bit (x86).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...