473,320 Members | 2,041 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,320 software developers and data experts.

DLL Troubles

I'm trying to write two managed C++ .DLL files for use in a project, and am
running into some trouble that I'm not sure if it's something I'm doing
wrong (this is my first time trying this) or if it's something VS .NET 2k3
is doing to me. My problems are this:

1. The projects will not find standard functions like strcpy and new.
doesn't seem to even know what they are despite my having added the header
files for everything plus.

2. When I try to use these in my main project file (built in C#), it tells
me that my classes in the DLL's do not exist in my namespace and asks if I'm
missing an assembly reference. I know I have them referenced in the project
file, and the build order is such that both are compiled at the appropriate
times to ensure (theoretically) that everything that is depended on gets
compiled first, and in the case of my C# DLL projects, everything works
fine. Any ideas from anyone? Thanks

Tom
Nov 17 '05 #1
4 1213
Short answer: Managed C++ DLLs don't work yet (as of Visual Studio 2003).

You probably don't believe this but, really, it's true.

Apparently, some people have done this but you have to:
1) Not link in any Managed libraries including the standard .NET
runtime which is basically impossible
2) Not link in any unmanaged libraries uncluding the standard C/C++
ryntime which is also basically impossible.
3) Deal with all kinds of bizarre errors since no static/global
variables work correctly. Even those used internally by unmanaged
libraries (including the runtime).

Visual Studio 2005 hopefully will have a better solution.

Tom Andrecht wrote:
I'm trying to write two managed C++ .DLL files for use in a project, and am
running into some trouble that I'm not sure if it's something I'm doing
wrong (this is my first time trying this) or if it's something VS .NET 2k3
is doing to me. My problems are this:

1. The projects will not find standard functions like strcpy and new.
doesn't seem to even know what they are despite my having added the header
files for everything plus.

2. When I try to use these in my main project file (built in C#), it tells
me that my classes in the DLL's do not exist in my namespace and asks if I'm
missing an assembly reference. I know I have them referenced in the project
file, and the build order is such that both are compiled at the appropriate
times to ensure (theoretically) that everything that is depended on gets
compiled first, and in the case of my C# DLL projects, everything works
fine. Any ideas from anyone? Thanks

Tom

Nov 17 '05 #2
I don't have a lot of experience with this yet, but I experienced the same
thing. I got around it by just adding the library references for the
appropriate C/C++ runtime files. It seems that those are implicitly
available when compiling native, but have to be explicitly added just like
any other external libary when compiling managed.

They can be found (by default) under:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib

"Tommy Vercetti" wrote:
Short answer: Managed C++ DLLs don't work yet (as of Visual Studio 2003).

You probably don't believe this but, really, it's true.

Apparently, some people have done this but you have to:
1) Not link in any Managed libraries including the standard .NET
runtime which is basically impossible
2) Not link in any unmanaged libraries uncluding the standard C/C++
ryntime which is also basically impossible.
3) Deal with all kinds of bizarre errors since no static/global
variables work correctly. Even those used internally by unmanaged
libraries (including the runtime).

Visual Studio 2005 hopefully will have a better solution.

Tom Andrecht wrote:
I'm trying to write two managed C++ .DLL files for use in a project, and am
running into some trouble that I'm not sure if it's something I'm doing
wrong (this is my first time trying this) or if it's something VS .NET 2k3
is doing to me. My problems are this:

1. The projects will not find standard functions like strcpy and new.
doesn't seem to even know what they are despite my having added the header
files for everything plus.

2. When I try to use these in my main project file (built in C#), it tells
me that my classes in the DLL's do not exist in my namespace and asks if I'm
missing an assembly reference. I know I have them referenced in the project
file, and the build order is such that both are compiled at the appropriate
times to ensure (theoretically) that everything that is depended on gets
compiled first, and in the case of my C# DLL projects, everything works
fine. Any ideas from anyone? Thanks

Tom

Nov 17 '05 #3
If you play around with compile/link settings for a while, you can get
an MC++ DLL project to build. The problem is, support for static/global
variables is broken.

Even if you don't use static/global variables directly, you probably
indirectly use some standard library functionality that does and that
will now be unstable and often crash.

http://www.codeguru.com/columns/Kate/article.php/c3643/

Troy wrote:
I don't have a lot of experience with this yet, but I experienced the same
thing. I got around it by just adding the library references for the
appropriate C/C++ runtime files. It seems that those are implicitly
available when compiling native, but have to be explicitly added just like
any other external libary when compiling managed.

They can be found (by default) under:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib

"Tommy Vercetti" wrote:

Short answer: Managed C++ DLLs don't work yet (as of Visual Studio 2003).

You probably don't believe this but, really, it's true.

Apparently, some people have done this but you have to:
1) Not link in any Managed libraries including the standard .NET
runtime which is basically impossible
2) Not link in any unmanaged libraries uncluding the standard C/C++
ryntime which is also basically impossible.
3) Deal with all kinds of bizarre errors since no static/global
variables work correctly. Even those used internally by unmanaged
libraries (including the runtime).

Visual Studio 2005 hopefully will have a better solution.

Nov 17 '05 #4
"Tommy Vercetti" <ve*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
If you play around with compile/link settings for a while, you can get an
MC++ DLL project to build. The problem is, support for static/global
variables is broken.

Even if you don't use static/global variables directly, you probably
indirectly use some standard library functionality that does and that will
now be unstable and often crash.

http://www.codeguru.com/columns/Kate/article.php/c3643/


Right. And Kate points her readers to the knowledge base article available
here:

http://support.microsoft.com/?id=814472

On the one hand I don't want to sound as though I am minimizing the problem
described there, but on the other I don't think that your characterization
of "unstable and often crash" is entirely correct, either.

The article points out that initializing the runtime and static variables
while processing the DLL_PROCESS_ATTACH notification IS a timebomb because
that is what happens by default.

However, it you mark the mixed-mode DLL as having no entry point then
prohibited actions do not take place while the loader lock is held when
loading the DLL. The article goes on to point out how to construct an
exported initializer function which clients can call _after_ having loaded
the DLL when it is safe.

Does that not tack work for you?

Regards,
Will
Nov 17 '05 #5

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

Similar topics

33
by: Darren Dale | last post by:
I love the language. I love the community. My only complaint is that Python for Windows is built with Visual Studio. It is too difficult to build python, or a module, from source. This is what...
0
by: lmckaha | last post by:
Hi, Mysql version: 3.23.49 Solaris version: 2.7 gcc compiler version: 2.95.2 Python : 2.2.2 I'm evaluating the C and C++ API to decide which one to bye but I have many troubles.
3
by: Mr. B | last post by:
GRRRR... I've run across a situation in which I have NO solution. Hopefully there is one. VB.net. It's rather simple. I've a ComboBox that get's populated via a Database. And I pre-select...
4
by: jernej goricki | last post by:
Hy I'm trying to edit a XSLT document, just like I'm editing a XML document : (Im trying to make a new xsl:template tag here ) Dim myXml As New XmlDocument()...
4
by: Edwin G. Castro | last post by:
I want to start a process from a C# application. I also want to redirect standard error to standard output so that I can read output from both streams just like I could from a command line. In...
0
by: Stefan Slapeta | last post by:
Hi all, I've experienced some troubles with message tables and wanted to know if anybody knows a solution for one of them: - If I translate my .mc file into a Unicode .bin file, some of the...
0
by: D'ALMEIDA Jorge | last post by:
Well i'm trying to get the icon of the visibles windows. i'm using: EnumWindows, IsWindowVisible, and SendMessage with the "WM_GETICON" parameter sometimes then SendMessage function return...
0
by: Michal | last post by:
I have troubles with instaling .Net Framework 2.0 (Beta 2 - 2.0.50215). The main instalation went just fine, troubles begin with my attemt to run aspnet_regiss.exe -i. Asp.Net is instaled into IIS...
0
by: JohnIdol | last post by:
VC++6 to VC++2003 - linking troubles -------------------------------------------------------------------------------- Hi All, I successfully ported an application from VC++6 to VS2003. Solved...
1
by: Pegasus | last post by:
Good morning, I'm Filippo Battaglia. We're porting Apache STDCXX under Nanodesktop. We are trying to make nd compatible also with C++ and not only with C. Unfortunately, we're finding different...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.