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

Marshal Error

Here's the C prototype:

int* CHARtoINT(char* input)

and here's my VB.NET decleration:

<DllImport("DGRE.dll")> _
Public Shared Function CHARtoINT(ByVal input As String) As
Integer()
End Function

I get the error "Can not marshal return value", so, I'm at a loss.

Thanks,
Tibby
Nov 20 '05 #1
2 970
In article <kd********************************@4ax.com>,
ti***@tiberiansun.us says...
Here's the C prototype:

int* CHARtoINT(char* input)

and here's my VB.NET decleration:

<DllImport("DGRE.dll")> _
Public Shared Function CHARtoINT(ByVal input As String) As
Integer()
End Function


If the function is returning an address, try defining it as "IntPtr":

Public Shared Function CHARtoINT(ByVal input As String) As IntPtr

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #2
On Tue, 22 Jun 2004 12:24:16 -0400, Patrick Steele [MVP]
<pa*****@mvps.org> wrote:
In article <kd********************************@4ax.com>,
ti***@tiberiansun.us says...
Here's the C prototype:

int* CHARtoINT(char* input)

and here's my VB.NET decleration:

<DllImport("DGRE.dll")> _
Public Shared Function CHARtoINT(ByVal input As String) As
Integer()
End Function


If the function is returning an address, try defining it as "IntPtr":

Public Shared Function CHARtoINT(ByVal input As String) As IntPtr

In retrospect, it's a mute point because I need it to return String()
to vb, so I have to go and learn some more C++ now.

Thanks again Patrick,
Tibby
Nov 20 '05 #3

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

Similar topics

9
by: Angel | last post by:
Hi again, I'm trying to call functions from a proprietary DLL but it's turned out to be more difficult than I thought. I have this W32.DLL which was written in C by USPS. They don't provide the...
5
by: Daniel Brown | last post by:
I am coding a managed C# wrapper for an unmanaged C DLL and I am unable to marshal a structure that contains an array of structures. When executed, the following code throws an ArgumentException...
6
by: SB | last post by:
I feel dumb to ask because I bet this is a simple question... Looking at the code below, can someone please explain why I get two different values in my Marshal.SizeOf calls (see the commented...
6
by: Howard Kaikow | last post by:
Given: private struct PROCESSENTRY32 { public int dwSize; public int cntUsage; public int th32ProcessID; public int th32DefaultHeapID; public int th32ModuleID;
2
by: abcd | last post by:
I have the following code which is sent over the wire as a string... from time import time class Foo: def go(self): print "Time:", time() I get this code and store it as, "data"
3
by: preitymathur0422 | last post by:
I m working on a MDI application. Here on the parent form I had two variables declared as public int curUserID = 0, ViewUserID = 1; the form is inherited by the "Form" class. I m using these...
4
by: Larry Smith | last post by:
Hi there, Does anyone know if this (example) is safe: internal static extern int GetWindowRect(IntPtr hWnd, ref RECT rect); int rc = GetWindowRect(hWnd, ref rect); if (rc == 0)
4
by: cleanrabbit | last post by:
Hello! I hate having to do this, because im almost certain there is someone in the world that has come across this problem and i just havent found their solution yet, so i do appologise if this...
2
by: O.B. | last post by:
When using Marshal to copy data from a byte array to the structure below, only the first byte of the "other" array is getting copied from the original byte array. What do I need to specify to get...
0
by: yogiam | last post by:
I have a server listening for connections. Client connects and both start streaming webcam images. This works fine as long as there is only one client connected(running as a Thread). When another...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.