ObjectArx (A2K) calling function from DLL

ObjectArx (A2K) calling function from DLL

Anonymous
Not applicable
186 Views
3 Replies
Message 1 of 4

ObjectArx (A2K) calling function from DLL

Anonymous
Not applicable
Owen Wengerd wrote:
>
> Darek:
>
> >Are there any problems with calling functions from dlls?
>
> No. The function in the DLL may be using a different calling convention
> than your typedef. Make sure your CALLBACK macro is what you think it is.
> 🙂

Thaks a lot. You were right. CALLBACK means FAR PASCAL. Program started,
when I used FAR only instead.

> Owen Wengerd

--
darek ciesla
designers
poland
0 Likes
187 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Hello,

I want to call the function from znotes.DLL (line marked with ***).
Function itself works fine, but when it finishes I receive an error:
Unhandled exception .... ..... at 7801e324h. When I debug my application
I stop in deasembled msvcrt after this error.
Are there any problems with calling functions from dlls? Or this is just
my problem?
It hapens even if I call simple function (like alert) - I've got the
alert box, then the error.

Thx,
darek ciesla
designers
poland

Here is some code:
typedef int (CALLBACK* DLLCOPYOUTKR)(char*, char*, char*, char*);
typedef int (CALLBACK* DLLCOPYOUTDER)(char*, char*);
HINSTANCE hDLL; // Handle to DLL

hDLL = LoadLibrary("znotes");
DLLCOPYOUTKR lpfnDllFunc; // Function pointer
if (hDLL != NULL) {
lpfnDllFunc = (DLLCOPYOUTKR)GetProcAddress(hDLL,"CopyOutKR");
if (!lpfnDllFunc) {
// handle the error
acdbFail("GetProcAddress Error.");
FreeLibrary(hDLL);
return RTERROR;
}
else {
// call the function
*** error = lpfnDllFunc(nrKR, nrDER, lista_obrebow, zakres);
if (error == 0) {
//evrything ok
return RTNORM;
}
else {
acdbFail("Error inside Notes API: ");
return RTERROR;
}
}
}
else {
acdbFail("Error loading znotes.dll");
return RTERROR;
}
}
0 Likes
Message 3 of 4

Anonymous
Not applicable
Darek:

>Are there any problems with calling functions from dlls?

No. The function in the DLL may be using a different calling convention
than your typedef. Make sure your CALLBACK macro is what you think it is.
:)
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com
0 Likes
Message 4 of 4

Anonymous
Not applicable
Owen Wengerd wrote:
>
> Darek:
>
> >Are there any problems with calling functions from dlls?
>
> No. The function in the DLL may be using a different calling convention
> than your typedef. Make sure your CALLBACK macro is what you think it is.

But when I make Console Application evrything works fine.

> Owen Wengerd

--
darek ciesla
0 Likes