Click here to Skip to main content
16,005,119 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: To Pause a Thread Pin
palbano9-Jun-04 5:57
palbano9-Jun-04 5:57 
GeneralRe: To Pause a Thread Pin
cberam10-Jun-04 2:04
cberam10-Jun-04 2:04 
Generaldisplaying window on checking password Pin
Anonymous9-Jun-04 1:10
Anonymous9-Jun-04 1:10 
GeneralRe: displaying window on checking password Pin
Diddy9-Jun-04 1:54
Diddy9-Jun-04 1:54 
GeneralRe: displaying window on checking password Pin
David Crow9-Jun-04 3:18
David Crow9-Jun-04 3:18 
Generalproblem with PreTranslateMsg and Tab Order Pin
YaronNir8-Jun-04 23:37
YaronNir8-Jun-04 23:37 
GeneralRe: problem with PreTranslateMsg and Tab Order Pin
YaronNir8-Jun-04 23:53
YaronNir8-Jun-04 23:53 
Generalpbs with DLLs... Pin
JRacle8-Jun-04 23:28
JRacle8-Jun-04 23:28 
Hi,

I have a problem regarding embedded dlls (managed and unmanaged).. Could you help me please ?

My problem is the following..
- my target is a Pocket PC
- I want to export an unmanaged dll that I've done using Embedded Visual C++ 4.0 and wrap it with a managed dll written in C++. My unmanaged class is :

header :
--------
#ifdef UNM

#define DLL_API __declspec(dllexport)

#else

#define DLL_API __declspec(dllimport)

#endif

class DLL_API DLLUnmanaged

{

public:


DLLUnmanaged();

DLLUnmanaged(const char * const);

~DLLUnmanaged();

const char * getstring() const {return str;}

char * suffix(int n);


private:

char * str;

unsigned short len;

};


cpp:
#include

#include "stdafx.h"

#pragma warning( disable : 4091 )

#include "UnmanagedDLL.h"

BOOL APIENTRY DllMain( HANDLE hModule,

DWORD ul_reason_for_call,

LPVOID lpReserved

)

{

return TRUE;

}

DLLUnmanaged::DLLUnmanaged()

{

str = (char *)LocalAlloc(0, sizeof(char));

str[0] = '\0';

len = 0;

}

DLLUnmanaged::DLLUnmanaged(const char * const str0)

{

len = (unsigned short)strlen(str0);

str = (char *) LocalAlloc(0, sizeof(char)*(len+1));

for(unsigned short i = 0; i < len; i++)

str[i] = str0[i];

str[i] = '\0';

}

char * DLLUnmanaged::suffix(int pos)

{

unsigned short suffix_length;

pos--;

if (pos < 0) pos = 0;

suffix_length = len - pos + 1;


if (suffix_length > 0)

{

char * suff = new char[suffix_length];

for(unsigned short i = pos; i < len+1; i++)

suff[i - pos] = str[i];

return suff;

} else

return 0;

}

DLLUnmanaged::~DLLUnmanaged()

{

LocalFree(str);

len = 0;

}

- I want to use the managed extensions of Visual Studio .Net like this :
#using

using namespace System;

#include

using std::cout; using std::endl;

#include "path.../UnmanagedDLL.h"

public __gc class DLLManaged // to avoid using "DLLImport"s..

{

public:

String * find_suffix(String * s, int pos)

{

int length = s->Length;

char * in_string = new char[length+1];

for(unsigned short i = 0; i
{

in_string[i] = (char)s->Chars[i];

}

in_string[length] = '\0';

DLLUnmanaged * s0 = new DLLUnmanaged(in_string);

delete [ ] in_string;

return s0->suffix(pos);

}


};

... so here is what I've done when doing it only with Visual Studio .Net. I've added to the solution (that has got the unmanaged (I took "DLL MFC") and managed (I took ".Net DLL") ) a C# windows application that simply references the managed dll. All that works fine..

but if I want to make a project like this (actually the unmanaged dll that I use is a bit more complicated that the one I gave you) for a Pocket PC I encounter a lot of problems (please don't blame me, I'm a beginner!)

I tried to do it this way. The thing is that I don't know how to make an EMBEDDED MANAGED C++ DLL...

if I do the unmanaged project with Embedded Visual C++ 4, and if I make a .Net DLL similar to the one I've given to you upper, I get errors like:

ManagedDLL error LNK2020: jeton non résolu (0A000009) _CxxThrowException
ManagedDLL error LNK2020: jeton non résolu (0A00000B) delete
ManagedDLL fatal error LNK1120: 2 externes non résolus
(sorry, I've the French version of VS .Net)

obviously the linkage goes wrong..

So..what is the thing I've to do ? could you help me please, since I'm trying to fix the problem for many days now!

thanks to pay attention to it, Smile | :)
Julien (IT student)
GeneralBack Ground color of a print preview window Pin
Thanvir Hussain8-Jun-04 22:51
Thanvir Hussain8-Jun-04 22:51 
GeneralRe: Back Ground color of a print preview window Pin
Roger Allen8-Jun-04 23:46
Roger Allen8-Jun-04 23:46 
Generalthe release version do not work properly Pin
mujun8-Jun-04 22:43
mujun8-Jun-04 22:43 
GeneralRe: the release version do not work properly Pin
David Crow9-Jun-04 3:23
David Crow9-Jun-04 3:23 
GeneralRe: the release version do not work properly Pin
mujun9-Jun-04 14:26
mujun9-Jun-04 14:26 
GeneralWait Pin
Anonymous8-Jun-04 22:00
Anonymous8-Jun-04 22:00 
GeneralRe: Wait Pin
jmkhael8-Jun-04 22:06
jmkhael8-Jun-04 22:06 
Generalkeyboar hook unicode Pin
arthi_mclt8-Jun-04 21:08
arthi_mclt8-Jun-04 21:08 
GeneralBitmap problem Pin
Imtiaz Murtaza8-Jun-04 20:57
Imtiaz Murtaza8-Jun-04 20:57 
GeneralRe: Bitmap problem Pin
Frank K8-Jun-04 22:42
Frank K8-Jun-04 22:42 
GeneralRe: Bitmap problem Pin
V.9-Jun-04 2:07
professionalV.9-Jun-04 2:07 
GeneralRe: Bitmap problem Pin
basementman9-Jun-04 11:10
basementman9-Jun-04 11:10 
GeneralInternetConnect problem Pin
Anonymous8-Jun-04 19:41
Anonymous8-Jun-04 19:41 
GeneralRe: InternetConnect problem Pin
Ted Ferenc8-Jun-04 21:36
Ted Ferenc8-Jun-04 21:36 
GeneralRe: InternetConnect problem Pin
Anonymous8-Jun-04 23:40
Anonymous8-Jun-04 23:40 
GeneralRe: InternetConnect problem Pin
Ted Ferenc9-Jun-04 0:04
Ted Ferenc9-Jun-04 0:04 
GeneralRe: InternetConnect problem Pin
Anonymous9-Jun-04 0:29
Anonymous9-Jun-04 0:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.