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

G

Guest

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
 
C

clintonG

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 said:
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?
 
G

Guest

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
 
M

Michael O'Brien

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 said:
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.
 
C

clintonG

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top