473,657 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dllexport for vc 6.0 c++

Hi all,

I needed a way to provide vc 6.0 c++ code a way to call managed dlls
compiled in vs 2003. In order to do this I created a wrapper (in vs
2003) for the managed code and made the functions accessible with dll
export.

I then wrote a test application in vc 6.0 which included the .lib file
created from dllexport and called the managed code through it.
Everything works just fine. However, somehow it just seems a little
too good to be true. I'm wondering if I am going to pay for this
approach somewhere down the line.

Does anybody have experience with interoperabilit y between vs6 and vs7
code? Your comments are most welcome.

Thanks,

Henri

Feb 8 '07 #1
2 1135
I needed a way to provide vc 6.0 c++ code a way to call managed dlls
compiled in vs 2003. In order to do this I created a wrapper (in vs
2003) for the managed code and made the functions accessible with dll
export.

I then wrote a test application in vc 6.0 which included the .lib file
created from dllexport and called the managed code through it.
Everything works just fine. However, somehow it just seems a little
too good to be true. I'm wondering if I am going to pay for this
approach somewhere down the line.

Does anybody have experience with interoperabilit y between vs6 and vs7
code? Your comments are most welcome.
Hi,

Yes, Life can really be that good. As long as you live by the following
rules, everything is hunky-dory:
- do not deallocate memory that was allocated in another module.
- do not use classes in your public interface. Only plain C functions and
plain old data arguments.
- do not let exceptions escape beyond module boundaries. Use simple return
values.

All praise the power of Visual C++ :-)

--

Kind regards,
Bruno van Dooren
br************* *********@hotma il.com
Remove only "_nos_pam"
Feb 8 '07 #2

"Bruno van Dooren [MVP VC++]" <br************ **********@hotm ail.comwrote
in message news:eG******** ******@TK2MSFTN GP03.phx.gbl...
>I needed a way to provide vc 6.0 c++ code a way to call managed dlls
compiled in vs 2003. In order to do this I created a wrapper (in vs
2003) for the managed code and made the functions accessible with dll
export.

I then wrote a test application in vc 6.0 which included the .lib file
created from dllexport and called the managed code through it.
Everything works just fine. However, somehow it just seems a little
too good to be true. I'm wondering if I am going to pay for this
approach somewhere down the line.

Does anybody have experience with interoperabilit y between vs6 and vs7
code? Your comments are most welcome.

Hi,

Yes, Life can really be that good. As long as you live by the following
rules, everything is hunky-dory:
- do not deallocate memory that was allocated in another module.
- do not use classes in your public interface. Only plain C functions and
plain old data arguments.
- do not let exceptions escape beyond module boundaries. Use simple return
values.
That advice will work great with VS2005 (vc8). vc7 though may cause random
failures due to things like bugs in the managed c++ runtime library relating
to loader lock, and syntax that lets you pass unpinned managed objects to
native functions.
>
All praise the power of Visual C++ :-)

--

Kind regards,
Bruno van Dooren
br************* *********@hotma il.com
Remove only "_nos_pam"

Feb 12 '07 #3

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

Similar topics

3
5306
by: Cengiz | last post by:
Hi, i've created DLL with VC++ 6.0 with the following code. -------------------------------------------------- int __declspec(dllexport) initialize(void) { MessageBox(0,"TEST","TEST",0); return 0; }
3
2601
by: Gawel | last post by:
Hajo, I have two dlls, both of them are compiled with /clr switch. In first dll project I have managed and unmanaged classes. One of the unmanaged I would like to use outside therefore I marked it as follows: class __declspec(dllexport) Terrain { public: void foo(){} };
5
2218
by: Jason W | last post by:
I have a C# class that I wan't to be able to use in VB6 and VBA applications. To do this I was trying to use a mixed managed VC++ dll and export a function. Doing this I get an error "The memory could not be "read"". Can any one explain what I am doing wrong? This is my Code.
8
12454
by: bonk | last post by:
Hello, I created a MFC extension dll (using VS 2005 Beta 2) that is supposed to export a class that uses .NET internally (See header below) und later shall be used by a plain MFC Project (without the /CLR). As soon as I try to specify __declspec(dllexport) (AFX_EXT_CLASS) I get the following compiler error: Error 2 error C3395: 'CWPFControlProxy::OnWPFButtonClick' : __declspec(dllexport) cannot be applied to a function with the...
7
1910
by: Martin Pritchard | last post by:
Hi, Sorry for my ignorance, but I'm a bit new to C++. I've been handed over a C++ app written in VS2002 which I have to convert to VS2005. Apparently it's been written in a C style, but cannot comment myself! Following the conversion I have numerous errors, which following some digging around turns out to be because _export is obsolete, and
3
12436
by: majestik666 | last post by:
Hi, i'm bulding a multi platform app under windows/linux/osx an i have a bit of trouble exporting c++ symbols from a dynamic library... Under windows, i compile a dll exporting symbols using : __declspec(dllexport) & __declspec(dllimport) I do export non-static and static members from my c++ code
2
5120
by: Luis | last post by:
Hello... How can I do an exported function in Visual Basic.Net? In Visual C++ the source is the next... but I need the same in VB.Net Thank you /* This is an example of an exported function. */ __declspec(dllexport) int fnDLLSAMPLE(void) {
2
1753
by: Bit Byte | last post by:
I have written a Dll which contains a class. I overload the "<<" opertor in global functions to perform Ostream operations - a follows: ostream &operator << (ostream &os, const struct _mystruct_t &ms) However (perhaps unsuprisngly), my function is not expoted in the DLL/lib - and when I try to build a project that uses the Dll, I get linkage error: demo error LNK2019: unresolved external symbol "class
1
6282
by: =?Utf-8?B?RmFiaWFu?= | last post by:
Hello, I want to give multiple native classes (in different mixed mode dlls) access to a managed output window (for error messages). Therefore I wrote a native singleton with __declspec (dllexport). I get the following compiler errors: Error 224 error C3389: __declspec(dllexport) cannot be used with /clr:pure or /clr:safe Error 225 error C4394: 'ErrorHandler::instance' : per-appdomain symbol should not be marked with...
0
8403
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8316
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8610
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7345
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.