473,396 Members | 1,891 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,396 software developers and data experts.

Having problems with C# unsafe.

I'm calling the C++ function below from C#:

GENCLIENT_API int CleanseEx(char ncSystem, const char *strServer,
const char **pNames, const char **pInputData,
const char **pRules, char ***pOutputData);

I can call this function from a console application however when I attempt
to use the same code from within a web service I get the following error:

************************************************** *******
An unhandled exception of type 'System.Web.Services.Protocols.SoapException'
occurred in system.web.services.dll

Additional information: Server was unable to process request. --> Object
reference not set to an instance of an object.
************************************************** *******

I'm spinning my wheels trying to figure out if this is a pointer problem or
a code access securing problem, etc... Below are the variables and method
call from my C# application:

[DllImport(@"d:\tempdlllocation\genclient.dll",
arSet.Ansi,
EntryPoint="CleanseEx")]
private unsafe static extern int CleanseEx(char SystemId, string Server,
string[]Names, string[] InputData, string[] Rules, byte*** OutputData);

int retCode;
char _SystemId = 'G';
string _Server = "TestServer";
string[] _Names = new string[100];
string[] _Rules = new string[100];
string[] outputData = new string[100];

....... the various arrays are populated with data values.

unsafe
{
byte ** pOutput = null;
retCode = CleanseEx(_SystemId, _Server, _Names, _InputData, _Rules, &pOutput);
..... code fails on the call above when calling from web service.
}
.......

Any help or recommendations would be really appreciated.

Nov 16 '05 #1
0 989

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

Similar topics

2
by: Elidel | last post by:
Is the use of a COM object in a c# program considered 'unsafe' code ? Does the method that calls the COM object need the 'unsafe' keyword ? Is code that calls a COM object considered unmanaged?...
3
by: Andre | last post by:
if I have an unsafe method that takes in two arrays, performs some operations and returns; I know that the garbage collector will not collect objects allocated inside the unsafe method. However, if...
4
by: Jon Milner | last post by:
How do I declare that my code is unsafe? Sorry the help files at my University have not been installed!
2
by: Leandro H. Delamare | last post by:
Hello group. I'm with a problem a few days with Smart Cards I Have an C++ DLL with some funcions to read a Smart Card. But the problem is, I have the declarations in C++ and a Program Example in...
17
by: Bradley1234 | last post by:
Sorry if this is obvious, but Ill ask... Is there a new way of using pointer operations in C# ? Ive got a Deitel book on C# that neither mentions the word "pointer" nor "unsafe" in the index....
0
by: Robert Rae | last post by:
I'm calling the C++ function below from C#: GENCLIENT_API int CleanseEx(char ncSystem, const char *strServer, const char **pNames, const char **pInputData, const char **pRules, char...
0
by: DR | last post by:
I heard there is some trick to referencing statics in C# CLR stored procedure without having to mark the assembly as unsafe. Does anyone know this? This is usefull as the case of needing a little...
3
by: DR | last post by:
I heard there is some trick to referencing statics in VB.NET CLR stored procedure without having to mark the assembly as unsafe. Does anyone know this? This is usefull as the case of needing a...
0
by: DR | last post by:
is it possible to mark my CLR function as UNSAFE in code or visual studio anywhere so that wehn vs deploys, it creates unsafe assembly? (instead of me having to manualy deploy in tsql!)
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.