|
GetLastError [^] may help.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
|
still i am unable to solve my problem when I call my dll function
DebugError
-----------
Program:\Project\Test.exe
Module:
File:i386\chkespc.c
Line:42
The value of ESP was not properly saved across a function call.This is usually a result
of calling a function declared with no calling convention with a function pointer declared
with a different calling convention.
Trioum
|
|
|
|
|
Try to post the code, on mondays my CPMRU s battery pack charge is pretty down.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I was wondering if that was just me.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
by lot of R&D I find that This problem is occuring when I am calling
function with arguments i.e.
int function1(int arg)
when I callled the function without arguments no error is occuring
everything is fine i.e.
int function2();
Trioum
|
|
|
|
|
If it is a general issue, i.e. event an empty function give troubles then your calling convention is wrong.
I think you may (if you don't like to post the actual code), at least, post a simple test code that fails on your system.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
ok I am sending some piece of code
in my dll my function as follows
extern "C" __declspec(dllexport) void function1();
extern "C" __declspec(dllexport) int function2(int index);
DllMain()
{
}
void function1()
{
// some code
}
int function2(int index)
{
int somevalue
somevalue =index;
return somevalue;
}
now on my applcation.exe
extern "C" __declspec(dllimport) void function1();
extern "C" __declspec(dllimport) int function2(int index);
//function1()
CMyDialog::OnButton()
{
function1();
//no error
}
//Now I called function2()
CMyDialog::OnButton()
{
function2(5);
// Debug error that I already post
}
Trioum
|
|
|
|
|
Why your function definitions don't match function declarations?
Should be
extern "C"
{
__declspec(dllexport) int function2(int index)
{
int somevalue
somevalue =index;
return somevalue;
}
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I tried this sample.
But i am not getting error if i define just as
int function2(int index){ ...} why?
|
|
|
|
|
Because it is allowed.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hello Everybody,
I too have a same problem.
[1]having a function ABC(arg1, arg2) in a dll that does not uses MFC.
[2]explicitly loading the dll (through LoadLibrary()).
[3]fetching the address of ABC() by using GetProcAddress(...) and storing it in appropriate function pointer.
[4]calling ABC() through the function pointer.
In DEBUG mode when control reaches the function pointer I get a MessageBox with following message :
The value of ESP was not properly saved across a function call.This is usually a result
of calling a function declared with no calling convention with a function pointer declared
with a different calling convention.
MessageBox does not appears in RELEASE mode.
Regards.
|
|
|
|
|
If it only happens in Debug mode and works correctly in Release then perhaps this compiler bug is causing it.
I believe it only effects VC2002 and VC2003.
http://support.microsoft.com/kb/822039[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Problem solved. !!! !!!
I declared function pointer in following way :
typedef int (_stdcall *PFUN_ABC) (arg1, arg2);
PFUN_ABC pFunABC = (PFUN_ABC) GetProcAddress(hDLL, "ABC");
pFunABC(arg1, arg2);
Now works fine in DEBUG and RELEASE.
Thanks.
Regards.
|
|
|
|
|
Try changing your calling convention.
See if this works:
extern "C" int __stdcall Adddata(void* item);
|
|
|
|
|
I am gettng
error LNK2001: unresolved external symbol __imp__function2@2
Trioum
|
|
|
|
|
Hi,
How could I get the context meno on Briefcase?
And how can I refresh the recycle bin after deleting all files from it?
|
|
|
|
|
pther wrote: How could I get the context meno on Briefcase?
Didn't I answer this last week? I thought I was even a little bit helpful.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Hello dear friends,
I want to know How we can find the path of the file from the File handle?
Thanks in Advace.
ritz1234
|
|
|
|
|
try GetFinalPathNameByHandle.
-Saurabh
|
|
|
|
|
Hi Saurabh,
Thanks for the reply,
But it gives me errors
error C2065: 'GetFinalPathNameByHandle' : undeclared identifier
E:\Refrence Project Folder\TBHook\TBHook.cpp(106)
error C2065: 'VOLUME_NAME_NT' : undeclared identifier
I am using Visual Studio 6.0
Can you tell me what could be the reason?
Is it possible any other way?
ritz1234
|
|
|
|
|
It will work only in Vista.
If you want to get the file name in XP, you have to use NtQueryObject[^]. You have to dynamically load the function from ntdll.dll
|
|
|
|
|
ritz1234 wrote: But it gives me errors
ritz1234 wrote: Can you tell me what could be the reason?
Did you look at the Requirements section for this function in the documentation? It says:
Client Requires Windows Vista.
Server Requires Windows Server 2008.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
This [^] looks promising.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|