473,320 Members | 1,839 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.

Problem in Calling native code from managed c++ dll.

Hey,

I wrote a managed c++ class library in viusal studio 2005. This managed
c++ dll calls native C++ methods of an SDK. When I referenced this
managed c++ library in a console applciation written in C# for testing
every thing worked fine. Now I need to call the managed c++ class
library through web service written in C#. When I call managed c++
methods from web service the code crashes on the line from where the
native code starts( mean native class's objects are instatiated). Can
any one help me in this regard. It's kinda hurry. Thanks.

Jul 31 '06 #1
2 1795
Hi Haroon!
I wrote a managed c++ class library in viusal studio 2005. This managed
c++ dll calls native C++ methods of an SDK. When I referenced this
managed c++ library in a console applciation written in C# for testing
every thing worked fine. Now I need to call the managed c++ class
library through web service written in C#. When I call managed c++
methods from web service the code crashes on the line from where the
native code starts( mean native class's objects are instatiated). Can
any one help me in this regard. It's kinda hurry. Thanks.
What is the exact expection message?
It might have to do with the "security" settings; which might not allow
to call unmanaged code.

Greetings
Jochen
Aug 1 '06 #2

Haroon_Saeed wrote:
Hey,

I wrote a managed c++ class library in viusal studio 2005. This managed
c++ dll calls native C++ methods of an SDK. When I referenced this
managed c++ library in a console applciation written in C# for testing
every thing worked fine. Now I need to call the managed c++ class
library through web service written in C#. When I call managed c++
methods from web service the code crashes on the line from where the
native code starts( mean native class's objects are instatiated). Can
any one help me in this regard. It's kinda hurry. Thanks.
Generally speaking, web services run under restricted accouts and with
restricted privilieges. I'll bet you do not have the UnmanagedCode
SecurityPermission flag set when you are running under the web service.

Either mark your managed C++ with the SuppressUnmanagedCodeSecurity
attribute (but do this only if you are truly aware of the
implications!), or have your web service run under another account with
the correct permissions. In any case, you must be aware that this is a
potential security weakness to let a web service call on unmanaged,
unprotected, code.

Arnaud
MVP - VC

Aug 1 '06 #3

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

Similar topics

4
by: Tim Menninger | last post by:
Just started working on this and have not found any real good resources out there. We have a lot of native C++ Dll code that we use for our app. We want to share the code so that C# ASP.net code...
8
by: Nadav | last post by:
Hi, Introduction: ********************* I am writing a mixed mode application I have a COM module and a .NET module that communicate with each other. The COM exposes a custom sink interface,...
1
by: Bern McCarty | last post by:
What do you make of this? I cannot tell for sure but it almost seems as the the transition thunk to get back from the native bool method to the managed caller is looking at eax and, if any bit is...
1
by: H.B. | last post by:
Hi, I need to make a function that can display data on my Managed C++ app and be called by an unmanaged C++ DLL. Something like : void Form1::Form1_Load(System::Object * sender,...
4
by: quortex | last post by:
Hey all, I have been working on a project which consists of Native C++ code and managed C# code. In order for the managed C# code to be able to access the native layer I wrap some objects using...
3
by: Mali Guven | last post by:
Hello, I have a native DLL (written in C) which is supposed to call a managed DLL (was written in C#, and an entry point was injected modifying the ildasm'd code). The exectuable calls the...
2
by: Dave Burns | last post by:
Hello, We have a situation where a managed C++ assembly links with native C++ dll. There is a callback mechanism which calls back into the managed code asynchronously. Since native classes...
6
by: per9000 | last post by:
An interesting/annoying problem. I created a small example to provoke an exception I keep getting. Basically I have a C-struct (Container) with a function-pointer in it. I perform repeated calls...
1
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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...
0
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...
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)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.