random thoughts, formed in the twisted mind of a coder... RSS 2.0
# Thursday, 30 October 2008

If you have any general question about a topic and you can't find any article I wrote about it, please post it here and I'll try to answer it for you (no guarantees ;-)).

But please, if there is an article of the topic you're question is about, post it there.

 

Thursday, 30 October 2008 17:48:29 (W. Europe Standard Time, UTC+01:00)  #    Comments [7]
Q & A
Thursday, 30 October 2008 17:51:49 (W. Europe Standard Time, UTC+01:00)
[[COPIED from About Me]]

Hi Martijn Thie,

i am right now programming a C# dll for a vb app. I got a problem to use a struct defined in C# dll by the vb app. Here is my code:

The error information is type mismach when i compile the VB APP. Any idea , where come from this error. Thanks very much.

// C# DLL code
namespace CallerSpace
{

public interface Icall
{
void getSentence(myDATA d);
}

[StructLayout(LayoutKind.Sequential)]
public struct myDATA
{
public int time;
public int Status;
}

public class CALL: Icall
{

public void getSentence(myDATA d)
{
......
}

}

}

// VB Application code
Sub Main
Dim call As CallerSpace.Icall
Set call = New CallerSpace.CALL

Dim mdata As myDATA
mdata.Status = 1
mdata.time = 122

call.getSentence(mdata) // here: error > type mismatch

End Sub

bag
Thursday, 30 October 2008 18:04:23 (W. Europe Standard Time, UTC+01:00)
Hi Bag,

I'm not quite sure, but it might be the:
"Dim mdata As myDATA"

Maybe you want to declare it like this:
"Dim mdata As CallerSpace.myDATA"

I'm sorry that I can't be sure right now. As I'm attending the PDC 2008 in Los Angeles, United States right now, time is not on my hand. As there are many great new topics here and many great sessions I have to fly... :)

So, please try it. If it doesn't work, I'll try to help you later on...

Friday, 31 October 2008 11:24:15 (W. Europe Standard Time, UTC+01:00)
Hi Mrtijn Thie,

sorry i posted the question under "about me". And thanks for your time and your reply.

I have solved the problem last night. I pass the struct a reference. Then It works.
But I do not know why I can not pass the struct. Maybe my question is: how to pass values from C# dll to VB app, or vise versus.

PS:U are at the PDC 2008 right now? That cool.

Have a nice trip in the USA!


// C# DLL code
namespace CallerSpace
{

public interface Icall
{
void getSentence(ref myDATA d); // here I pass the struct as a reference
}

[StructLayout(LayoutKind.Sequential)]
public struct myDATA
{
public int time;
public int Status;
}

public class CALL: Icall
{

public void getSentence(ref myDATA d) // add "ref" here
{
......
}

}

}
bag
Tuesday, 05 May 2009 17:11:08 (W. Europe Daylight Time, UTC+02:00)
Hi Martijn;

I am facing the following problem. I have a DLL written in C++ and I don't know which methods and or properties it exports.
Is there a way to discover it by including the DLL into a Visual Studio (C#)project? I've googled a little bit and come across your article "Marshalling: using native DLL's in .NET" which is the closest material I could find.
Could you give me any hint and / or suggestion?

I apologize if this is not the proper forum to post my question.

Best Regards

Livio
Livio
Tuesday, 05 May 2009 22:18:46 (W. Europe Daylight Time, UTC+02:00)
Hi Livio,

Presuming that you have Visual Studio...

You can check all the exports of your DLL by using:
dumpbin /exports [PATH TO DLL]

Wednesday, 13 May 2009 11:06:06 (W. Europe Daylight Time, UTC+02:00)
Hello , I have a question about the parallel framework please help me :
Does it help in solving problems using the Divide and Conquer parallel programming model?
Thank you , I appritiate you r help.
Amal
Wednesday, 13 May 2009 11:40:45 (W. Europe Daylight Time, UTC+02:00)
The Parallel Framework (http://blog.rednael.com/2009/03/16/ParallelFrameworkDownloadAndSupport.aspx) helps you with task-management. It doesn't divide processes into tasks by itself, but rather enables you to make the choice which parts of should be separate tasks.
When you have found the optimum, this framework lets you create, manage and execute tasks in parallel.

All comments require the approval of the site owner before being displayed.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2017
Martijn Thie
Sign In
Statistics
Total Posts: 18
This Year: 0
This Month: 0
This Week: 0
Comments: 186
All Content © 2017, Martijn Thie
DasBlog theme adapted from 'Business' (originally by delarou)