473,394 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

/clr option for VC++ 2005

WXS
In VS2003 using /clr meant that you could not use declspec import/export to
import or export methods from a .dll so they could be used externally thus
requiring you to wrap a class using managed code and the /clr option with a
class that did not use that option.

Is the same true for VS2005 or has that issue been resolved?
Nov 17 '05 #1
6 1485
"WXS" <WX*@discussions.microsoft.com> wrote in message
news:70**********************************@microsof t.com...
In VS2003 using /clr meant that you could not use declspec import/export
to
import or export methods from a .dll so they could be used externally thus
requiring you to wrap a class using managed code and the /clr option with
a
class that did not use that option.

Is the same true for VS2005 or has that issue been resolved?


The situation is unchanged - you can't export a managed entry point, so if
you have managed code that you want to expose via DLL exports (which are
purely an unmanaged concept), you'll have to write an unmanaged wrapper over
your managed code and export that wrapper.

-cd
Nov 17 '05 #2
"WXS" <WX*@discussions.microsoft.com> wrote in message
news:70**********************************@microsof t.com...
In VS2003 using /clr meant that you could not use declspec import/export
to
import or export methods from a .dll so they could be used externally thus
requiring you to wrap a class using managed code and the /clr option with
a
class that did not use that option.

Is the same true for VS2005 or has that issue been resolved?


The situation is unchanged - you can't export a managed entry point, so if
you have managed code that you want to expose via DLL exports (which are
purely an unmanaged concept), you'll have to write an unmanaged wrapper over
your managed code and export that wrapper.

-cd
Nov 17 '05 #3
WXS
Thanks. I guess it makes sense, unfortunately we make heavy use of declspec
import/export as everything is a .dll so we would need to create wrappers for
every usage of managed code to avoid having to compile the majority of code
with the /clr option.

"Carl Daniel [VC++ MVP]" wrote:
"WXS" <WX*@discussions.microsoft.com> wrote in message
news:70**********************************@microsof t.com...
In VS2003 using /clr meant that you could not use declspec import/export
to
import or export methods from a .dll so they could be used externally thus
requiring you to wrap a class using managed code and the /clr option with
a
class that did not use that option.

Is the same true for VS2005 or has that issue been resolved?


The situation is unchanged - you can't export a managed entry point, so if
you have managed code that you want to expose via DLL exports (which are
purely an unmanaged concept), you'll have to write an unmanaged wrapper over
your managed code and export that wrapper.

-cd

Nov 17 '05 #4
WXS
Thanks. I guess it makes sense, unfortunately we make heavy use of declspec
import/export as everything is a .dll so we would need to create wrappers for
every usage of managed code to avoid having to compile the majority of code
with the /clr option.

"Carl Daniel [VC++ MVP]" wrote:
"WXS" <WX*@discussions.microsoft.com> wrote in message
news:70**********************************@microsof t.com...
In VS2003 using /clr meant that you could not use declspec import/export
to
import or export methods from a .dll so they could be used externally thus
requiring you to wrap a class using managed code and the /clr option with
a
class that did not use that option.

Is the same true for VS2005 or has that issue been resolved?


The situation is unchanged - you can't export a managed entry point, so if
you have managed code that you want to expose via DLL exports (which are
purely an unmanaged concept), you'll have to write an unmanaged wrapper over
your managed code and export that wrapper.

-cd

Nov 17 '05 #5
WXS wrote:
Thanks. I guess it makes sense, unfortunately we make heavy use of
declspec import/export as everything is a .dll so we would need to
create wrappers for every usage of managed code to avoid having to
compile the majority of code with the /clr option.


To be super clear, when compiling with /clr, everything that you could do in
your code before you can still do. The /clr option only enables you to do
more.

If you have a function F compiled with /clr, the Visual C++ compiler
produces two functions for F. One has the unmanaged calling convention and
one has the CLR calling convention. One of these functions actually does
work (i.e. represents the source code written for F), and the other function
thunks (a.k.a. p/invokes) to the other function. This enables any function
outside of a ref class, value class, or interface class to be exported with
dllexport.

Inside of ref classes, value classes, and interface classes, the compiler
only generates the CLR calling convention function.

There are numerous ways to control how all these features work. Reading
through the documentation is going to be your best help right now. For the
short term, I'd encourage just recompiling all your code with /clr to see
that it still works.

Hope that helps!

--
Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/
Bugs? Suggestions? Feedback? http://msdn.microsoft.com/productfeedback/

Nov 17 '05 #6
WXS wrote:
Thanks. I guess it makes sense, unfortunately we make heavy use of
declspec import/export as everything is a .dll so we would need to
create wrappers for every usage of managed code to avoid having to
compile the majority of code with the /clr option.


To be super clear, when compiling with /clr, everything that you could do in
your code before you can still do. The /clr option only enables you to do
more.

If you have a function F compiled with /clr, the Visual C++ compiler
produces two functions for F. One has the unmanaged calling convention and
one has the CLR calling convention. One of these functions actually does
work (i.e. represents the source code written for F), and the other function
thunks (a.k.a. p/invokes) to the other function. This enables any function
outside of a ref class, value class, or interface class to be exported with
dllexport.

Inside of ref classes, value classes, and interface classes, the compiler
only generates the CLR calling convention function.

There are numerous ways to control how all these features work. Reading
through the documentation is going to be your best help right now. For the
short term, I'd encourage just recompiling all your code with /clr to see
that it still works.

Hope that helps!

--
Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/
Bugs? Suggestions? Feedback? http://msdn.microsoft.com/productfeedback/

Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Ramaraj M Bijur | last post by:
Hi All, Could anyone help me to resolve following problem in C the IDE used is Microsoft VC++, Please let me know the which option in VC++ will do the needful The problem statement:...
16
by: | last post by:
Hi , We have a lot of code which runs fine under VC++ 6.0. We have to move to ..NET becasue one of the librairies uses .NET classes. Does every library(including those which do not use .NET...
1
by: Hosalli | last post by:
Can I save my work done in VC++ 2005 Express Edition so as to work in VC++ 6.0? If yes how do I do it? I need this as I've got to submit my assignments to my instructor who uses VC++ 6.0. ...
8
by: david_75 | last post by:
I wonder if the transistion from the project written in VC++ 6.0 to VC++ .NET requires a lot of code changes (if any) if I compile the project in native code (or unmanaged code) without using the...
7
by: Mihajlo Cvetanović | last post by:
Hi all, I've been trying to find some info on Visual C++ 2005 Standard on Microsoft's site, but wasn't able to find any. There's only VC++ 2005 Express Edition, and Visual Studio 2005 Standard,...
2
by: Jacquie | last post by:
I have a MFC app that was developed with VC++ 2003 7.1 . I have now upgraded to VC++ 2005 8.0. Eventually I plan on using a Windows Form Control and hosting it on existing dialog. 1) First I...
6
by: meyzhong | last post by:
Hi, I am new to Visual C++ (6.0). I want to put all the print information in different lines into a box. I create a EDIT dialogue box, and then add a CString variable (m_MSG) to the dialogue...
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
1
by: davidmurray1 | last post by:
I am trying to write a device driver, and I need to set the project's system link to /SUBSYSTEM:NATIVE (as opposed to WINDOWS or CONSOLE), but the option isn't under the drop down box. If I try to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.