473,487 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

I need to allow unsafe code, but have no option to do so...

I'm using a C++ dll and need to allow unsafe code because the dll function takes char *. I am using Visual Studio.NET 2002. Everything I've seen says to go to the project properties page, then the build properties page and allow it there. For some reason, my project does not have a build properties page, only a configuration properties page. Can I add a build properties page somehow?

Is this because I am not using the command line compiler? Or because my project is an ASP.NET Web Application and they for some reason don't allow this here?

This is supposed to be soooo easy and it's holding me up big time. Any help would be very appreciated.

lesterZ
Nov 16 '05 #1
4 2457
Get the QUE 70-315 MCAD Training Guide as it covers the
several methdologies that can be used to reuse legacy COM.
It is an outstanding book that covers all of the issues related
to development, testing, and deployment of ASP.NET.

You also want to use Google or MSDN to learn about
the "Type Library Importer" (tlbimp.exe) but if you had
the QUE Training Guide you would have known that. :-)

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"lester" <le****@discussions.microsoft.com> wrote in message
news:DD**********************************@microsof t.com...
I'm using a C++ dll and need to allow unsafe code because the dll function takes char *. I am using Visual Studio.NET 2002. Everything I've seen says to
go to the project properties page, then the build properties page and allow it
there. For some reason, my project does not have a build properties page, only
a configuration properties page. Can I add a build properties page somehow?
Is this because I am not using the command line compiler? Or because my project is an ASP.NET Web Application and they for some reason don't allow this
here?
This is supposed to be soooo easy and it's holding me up big time. Any help would be very appreciated.
lesterZ

Nov 16 '05 #2
if it's a standard Win32 C++ DLL that takes a char* as one of its exported functions, then you can call it from C# just passing a string, you don't even need to use StringBuilder in order to marshal it correctly (you do need to use StringBuilder I think if you want to get the value back after it's been modified). I've got such functions in my app and they work fine. You don't need 'unsafe' blocks to do this.
The dll needs to be in the bin directory of the webapp, e.g. c:\inetpub\wwwroot\WebAppProject1\bin\TheCDLL.dll

"lester" wrote:
I'm using a C++ dll and need to allow unsafe code because the dll function takes char *. I am using Visual Studio.NET 2002. Everything I've seen says to go to the project properties page, then the build properties page and allow it there. For some reason, my project does not have a build properties page, only a configuration properties page. Can I add a build properties page somehow?

Is this because I am not using the command line compiler? Or because my project is an ASP.NET Web Application and they for some reason don't allow this here?

This is supposed to be soooo easy and it's holding me up big time. Any help would be very appreciated.

lesterZ

Nov 16 '05 #3
Hi,

I just checked in my copy of vs2002 and in project properties, a folder
called Configuration Properties is listed. Once I double-click that, a Build
Options section appears and I can enable unsafe code there.

Hope that helps,

cheers
Michael
"lester" <le****@discussions.microsoft.com> wrote in message
news:DD**********************************@microsof t.com...
I'm using a C++ dll and need to allow unsafe code because the dll function takes char *. I am using Visual Studio.NET 2002. Everything I've seen says
to go to the project properties page, then the build properties page and
allow it there. For some reason, my project does not have a build
properties page, only a configuration properties page. Can I add a build
properties page somehow?
Is this because I am not using the command line compiler? Or because my project is an ASP.NET Web Application and they for some reason don't allow
this here?
This is supposed to be soooo easy and it's holding me up big time. Any help would be very appreciated.
lesterZ

Nov 16 '05 #4
The QUE MCAD Training Guide I referred to describes and
documents with code the 3 different methods of reusing legacy
COM; direct (as Beeeeeee seems to be using), indirect, and
PInvoke run-time callable wrappers.

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/


"Michael O'Brien" <mi**************@no-spam-hotmail.com> wrote in message
news:er**************@TK2MSFTNGP12.phx.gbl...
Hi,

I just checked in my copy of vs2002 and in project properties, a folder
called Configuration Properties is listed. Once I double-click that, a Build
Options section appears and I can enable unsafe code there.

Hope that helps,

cheers
Michael
"lester" <le****@discussions.microsoft.com> wrote in message
news:DD**********************************@microsof t.com...
I'm using a C++ dll and need to allow unsafe code because the dll function

takes char *. I am using Visual Studio.NET 2002. Everything I've seen says
to go to the project properties page, then the build properties page and
allow it there. For some reason, my project does not have a build
properties page, only a configuration properties page. Can I add a build
properties page somehow?

Is this because I am not using the command line compiler? Or because my

project is an ASP.NET Web Application and they for some reason don't allow
this here?

This is supposed to be soooo easy and it's holding me up big time. Any

help would be very appreciated.

lesterZ


Nov 16 '05 #5

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

Similar topics

7
3284
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
0
963
by: lester | last post by:
I'm using a C++ dll and need to allow unsafe code because the dll function takes char *. I am using Visual Studio.NET 2002. Everything I've seen says to go to the project properties page, then the...
1
1669
by: lester | last post by:
I'm using a C++ dll and need to allow unsafe code because the dll function takes char *. I am using Visual Studio.NET 2002. Everything I've seen says to go to the project properties page, then the...
13
1663
by: vidalsasoon | last post by:
I need to send a pointer value to a fuction :( This is what it is expecting. BaseEffect.SetValue(Microsoft.DirectX.Direct3D.EffectHandle, void*, int) The problem is the void* part. I'm...
1
1628
by: Z | last post by:
Hello, In my C# program I have a function that uses pointers. Is there a way to tell the compiler to compile only this function with the unsafe switch and compile the remaining project as safe...
4
23337
by: fniles | last post by:
I have an ActiveX control in my web page that I tried to access using intranet. I have implemented IObjectSafety in the ActiveX control, and when I created the CAB file using VB Pakage and...
3
2859
by: BlueTrin | last post by:
I am using a DLL written in C, it uses some pointers on functions, I have defined a wrapper around it in C# which uses some delegates: #region Delegates and Marshalling to call solvopt public...
0
2513
by: Pucca | last post by:
Hi I'm using vs2005. I am getting a bunch of compiler warnings after I made some changes to my code that was compiling clean. I'm also getting memory errors when I run my program and it's...
5
6081
by: Andy | last post by:
Hi, I have a question... I have some code which has an unsafe block in it. In VS2008 (Framework 3.5), i go to the project property and check the box that allows unsafe blocks. The code...
0
7106
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,...
0
7181
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
7349
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...
1
4874
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3076
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...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
267
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...

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.