Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 30th, 2004, 09:19 PM
Registered User
 
Join Date: May 2004
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to pass address of an array to a dll(in c++)

HI..
i'm a newbie in using vb.net...
need help on how to pass address of an array to a dll(coded in c++). i am just testing out my intended coding in a simpler code as shown below.

code is somthing like this

Public Shared Sub testpoint(ByRef N() As Byte)
' Leave function empty - DLLImport attribute forwards calls to
' testpoint to testpoint in test1.DLL.
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Dim c(20) As Byte
testpoint(c)
MsgBox(c(9))
End Sub

*function to call in the test1.dll*
void testpoint(char & output)
{
char * t = &output;
t[9] = 'a';
t[10]='b';
}

i have created an array which can holds 21 items... but when i call the dll.. the array i got back is just contain 1 item..c(0).

is this the correct way to do it? or there is a better way?
Pls help...

thks in advance...
iceman11




Similar Threads
Thread Thread Starter Forum Replies Last Post
array address problem chris1012 Java Basics 3 December 18th, 2007 11:46 AM
DLL Base Address cf2006 BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 July 14th, 2006 10:59 AM
How to Pass c++ object across ATL DLL ann123 Visual C++ 0 January 30th, 2006 06:55 AM
Take the address of a stack based array Obnox BOOK: Professional C#, 2nd and 3rd Editions 1 April 21st, 2005 08:12 AM
How to pass option button array? John Pennington Classic ASP Professional 2 March 8th, 2004 04:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.