how to interface progress with C dll

Posted by ccleaud on 06-Jun-2007 10:11

Hello,

I'm encoutring a problem when i want to interface a progress program with a C DLL.

The header of the C function is :

int test_appel(char* request, char*response);

So I developped this program to send a request to this dll :

PROCEDURE test_appel EXTERNAL "madll.dll" PERSISTENT :

DEFINE INPUT PARAMETER request AS CHAR.

DEFINE OUTPUT PARAMETER response AS MEMPTR.

DEFINE RETURN PARAMETER ans AS SHORT.

END.

DEFINE VARIABLE retour AS INTEGER NO-UNDO.

DEFINE VARIABLE essai AS MEMPTR NO-UNDO.

ASSIGN SET-SIZE(essai) = 8192

PUT-BYTE(essai,8192) = 0.

DEFINE VARIABLE req AS CHARACTER INIT "yep" NO-UNDO.

RUN test_APPEL(INPUT req, OUTPUT essai, OUTPUT retour).

MESSAGE retour GET-STRING(essai,1)

VIEW-AS ALERT-BOX INFO BUTTONS OK.

But when I run the program I've got this error :

Coul not find the entrypoint testappel@8. (3260)

I don't understand why.

Please help me!

All Replies

Posted by Admin on 06-Jun-2007 12:22

I assume this is on Windows. Check your compiler settings for the calling convention you're using (C-declaration or STDCALL). Did you export the C-function in your DLL-project (defined it in the .def file)?

So start with defining the C-function like:

extern C int test_appel(char* request, char*response);

This thread is closed