Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Parameter lost in DLL

0 views
Skip to first unread message

Thomas

unread,
Jul 4, 2005, 11:17:32 AM7/4/05
to
Hello,
I've got a problem with calling functions in my DLL on Smartphone 2003,
using Embedded Visual C++ 4.
I have implemented a testapplication which calls a dll-function with 4
parameters, lets say function(1,2,3,4).
My DLL unfortunately receives (2,3,4,NULL). Obviously the parameters
have moved to a different memory address.
When I tried to debug in the emulator, I saw, that the emulator does
not show this behaviour. Obviously it depends on the processor type but
all the project setting seem to have no influence on the result.

Any ideas?

Ciao,
Thomas

Alex Feinman [MVP]

unread,
Jul 4, 2005, 6:54:06 PM7/4/05
to
Sounds like you have a mismatch in function definition between DLL and EXE.

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Thomas" <krue...@tegaron.de> wrote in message
news:1120490252.5...@f14g2000cwb.googlegroups.com...

Thomas

unread,
Jul 5, 2005, 4:07:42 AM7/5/05
to

Alex Feinman [MVP] schrieb:


> Sounds like you have a mismatch in function definition between DLL and EXE.

Thanks for your answer!
That's what I thought too, but the definitions are OK. The problem
applies to every function with more than one parameter.
Also call definitions like stdcall do not work.

Regards,
Thomas

Alexander Shargin

unread,
Jul 5, 2005, 11:38:59 AM7/5/05
to

Could you post some code fragments illustrating how your functions are
implemented in DLL and how they are called from EXE?

--
Alexander Shargin
Microsoft MVP in Mobile Devices
http://www.pocketpcdn.com - Pocket PC Developer Network
http://www.smartphonedn.com - Smartphone Developer Network
http://www.rsdn.ru - Russian Software Developer Network


"Thomas" <krue...@tegaron.de> ???????/???????? ? ???????? ?????????:
news:1120490252.5...@f14g2000cwb.googlegroups.com...

Thomas

unread,
Jul 6, 2005, 4:28:09 AM7/6/05
to
> Could you post some code fragments illustrating how your functions are
> implemented in DLL and how they are called from EXE?

sorry, it looks a bit confusing but here we go...
This is part of the application:

testapp.h:
typedef void (CALLBACK* FUNC)(int parm1, int parm2, unsigned short*
str1, unsigned short* str2);
FUNC Function;

testapp.cpp:
dll = LoadLibrary(_T("TestDLL.dll"));
if (dll != NULL)
{
Function = (FUNC)GetProcAddress(dll, _T("Func"));
if (Function != NULL)
Function(7, 8, _T("str1"), _T("str2"));
}


and this is part of the DLL:
testdll.h:
__declspec(dllexport) void Func(int parm1, int parm2, unsigned short*
str1, unsigned short* str2);

testdll.cpp:
__declspec(dllexport) void Test::Func(int parm1, int parm2, unsigned
short* test1, unsigned short* test2)
{
CString str;
str.Format(_T("%d, %d, %s, %s"), parm1, parm2, test1, test2);
MessageBox(NULL, str, NULL, MB_OK);
}

and of course the definition file:
LIBRARY "TestDLL"
EXPORTS
Func

The function in the dll is currently member of a class called Test ;-)
But I tested a lot, also with a dll, which just exports a function, not
a class.
Thanks for your help!

Thomas

0 new messages