Hi all!
Please help me.
If I create a simple Managed C++ DLL and use this dll in VB >NET CF it
works fine.
But if I make managed code as a wrapper to the unmanaged code it fails.
So I was tring to make Managed Code as a wrapper to unmanaged code (in eVC
4.0). and using Managed DLL in vb .NET .
It links with out any error.
But as soon as it encounter eVC call it through exception as
System.TypeLoadException.
So my problem is "How do I link static eVC 4.0 (.LIB) to VC .NET managed
DLL. So that using same DLL I can create VB .NET CF application"
Can any body help me out?. I will be helpfull for me.
Regards,
Shrikant Chikhalkar
I am giving code that I am using
code inside eVC 4.0
/**********************************************/
/**********************************************/
#include <malloc.h>
#include <string.h>
class myMath
{
private:
int i;
int j;
public:
myMath()
{
}
~myMath()
{
}
int Add();
};
/**********************************************/
/**********************************************/
code inside VC.NET
/**********************************************/
/**********************************************/
#pragma once
#pragma unmanaged
#include "../../mathLib/test.h"
#pragma managed
//using namespace System;
namespace DLL
{
public __gc class Class1
{
public:
Class1()
{
}
~Class1()
{
}
void Add(int i,int j)
{
myMath myPtr;
int ret = myPtr.Add();
}
};
}
/**********************************************/
/**********************************************/
code inside VB .NET For smart devices
/************************************************/
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try
Dim myDLL As New DLL.Class1
myDLL.test(10, 10)
Catch ex As Exception
MsgBox(ex.ToString(), MsgBoxStyle.YesNo)
End Try
End Sub
/***********************************************/
Daniel Moth - 22 Feb 2005 14:17 GMT
Managed C++ is not supported on CE. Anything you got working was in an
unsupported scenario... Use VB or C# for NETCF and you can pinvoke to eVC
dlls.
Cheers
Daniel
--
http://www.danielmoth.com/Blog/
> Hi all!
>
[quoted text clipped - 116 lines]
>
> /***********************************************/
Chris Tacke, eMVP - 22 Feb 2005 14:18 GMT
THere are a few things to note:
1. Managed C++ is not supported.
2. Unamanged C++ must be written with eVC - Studio doesn't support it
3. The only way to consume unmanaged code from managed is with P/Invoke
This means that native LIBs are not consumable. To use them you'll have to
make a native DLL that you P/Invoke.

Signature
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate
> Hi all!
>
[quoted text clipped - 116 lines]
>
> /***********************************************/
Ginny Caughey [MVP] - 22 Feb 2005 15:38 GMT
Shrikant,
It is possible to create a managed C++ DLL that can be used with managed
apps on the Compact Framework, but it is not supported. What that means is
that if you get it working, fine, but probably nobody will help you with
that.

Signature
Ginny Caughey
.Net Compact Framework MVP
> Hi all!
>
[quoted text clipped - 116 lines]
>
> /***********************************************/