Discussions related to Visual Prolog
Rangarajan
Posts: 12
Joined: 1 Jun 2007 14:51

Calling convention in C/C++ DLL

Unread post by Rangarajan »

Hi,
I have upgraded to VIP 10 recently. When I create a default DLL project and Build it, it generates a DLL as expected. How do I configure the project to generate the corresponding LIB file? I noticed that in the distributed example "..\dll\myDll", the LIB and DLL files are both generated.

Another question: If I am consuming the DLL from C code, which is the correct predicate decorator to use: "language prolog", "language c" or "language stdcall"

Thanks,
Rangarajan
Rangarajan
Posts: 12
Joined: 1 Jun 2007 14:51

Re: Calling convention in C/C++ DLL

Unread post by Rangarajan »

My apologies! I noticed that in VIP 10, the LIB file is also generated and saved in a different directory. I missed this.

I would like your suggestion for my second question.

Regards,
Rangarajan
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Calling convention in C/C++ DLL

Unread post by Thomas Linder Puls »

It is always better to have one subject per mail. But now that the other part is "closed" I think it is fine.

C/C++ programmers can use many calling conventions (just like we can in Visual Prolog). You will have to use the convention that matches what the C/C++ programmer used.

Often they have used stdcall on exported routines, but it could also be c.

Looking at the C++ header file may help:
C/C++ declaration
C/C++ declaration
c-decl.png (33.65 KiB) Viewed 4489 times
The declaration containts a macro ZEXPORT which expands to __stdcall, so this predicate uses stdcall.
Regards Thomas Linder Puls
PDC
Rangarajan
Posts: 12
Joined: 1 Jun 2007 14:51

Re: Calling convention in C/C++ DLL

Unread post by Rangarajan »

Thanks a lot.

I will be careful next time about asking a single question in a post!

Regards,
Rangarajan
Post Reply