Lost Password?


  #1 (permalink)  
Old 03-21-2008, 07:01 PM
szahn szahn is offline
Newbie
 
Join Date: Mar 2008
Posts: 1
Rep Power: 0
szahn is on a distinguished road
Default Cannot marshal class array in function

I am getting an error in visual basic.net code when calling a function that returns an array of classes from the dll compiled in managed C++


Error:
"An unhandled exception of type 'System.Runtime.InteropServices.MarshalDirectiveEx ception' occurred in toolbartest.exe

Additional information: Can not marshal return value."

**********
C Code:
**********

#using <mscorlib.dll>
public __gc class gwindow {
public:
System::Int64 hwnd;
System::Int64 ipid;
System::String *szWindowText;
System::String *szClassText;
System::String *szExecFile;
};


gwindow *__declspec(dllexport) foo() __gc [];

gwindow * wn = new gwindow();
wn->hwnd = (System::Int64)(tempWind->hwnd);
wn->ipid = (System::Int64)(tempWind->pid);
arr->Add(wn);

gwindow *gwindows __gc [];
gwindows =
static_cast<__gc class gwindow * []>(arr->ToArray(__typeof( __gc class gwindow)));

return (gwindows);



*************
VB Code:
*************

Public Class gwindow
Dim hwnd As Int64
Dim ipid As Int64
Dim szWindowText As String
Dim szClassText As String
Dim szExecFile As String
End Class

<DllImport("library.dll")> _
Friend Shared Function foo() As gwindow()
End Function
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inline function Chinmoy C Tutorials 1 04-07-2008 04:13 PM
function pointer Chinmoy C Tutorials 0 03-19-2008 01:52 AM
Joomla! Tutorial #3: CSS Class Suffix takercena Tutorials 1 03-14-2008 02:51 PM
SecurityAudit vinay Visual Basic Programming 27 01-07-2008 01:14 PM


All times are GMT -5. The time now is 05:27 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads