Discussions related to Visual Prolog
Michel
Posts: 4
Joined: 8 Nov 2025 17:17

Need help about custom langage (C).

Post by Michel »

First of all, I wish you an Happy 2026 year.

I get some issues ibterfacing C and prolog. Here is the codes I try to let communicate with each other. Of course, it is just a test before extending my project to something more serious.

My very basic prolog file :

----------------------------------

implement taskWindow inherits applicationWindow
open core, stdio, vpiDomains

constants
mdiProperty : boolean = true.

class predicates
myRoutine : (integer) -> integer language c as "ExternCalc".

resolve
myRoutine externally

clauses
new() :-
applicationWindow::new(),
generatedInitialize().

// etc...

class predicates
onHelpAbout : window::menuItemListener.
clauses
onHelpAbout(TaskWin, _MenuTag) :-
Result = myRoutine(2), // <---- extern C routine
write(Result),
_AboutDialog = aboutDialog::display(TaskWin).

// etc...

----------------------------------

Compiler MVS 2026 gives a correct Sources.o from Sources.c

Here is the very very basic test "C" routine :

int ExternCalc(int input)
{
return(input * 3);
}

--------------------------------------

Visual Prolog 11 (personal edition) compilation return this error !

error lnk2525 : : 'obj64\taskWindow.B668E84D.obj' - undefined name 'ExternCalc'

Using 'stdcal' or 'cdecl' gives the same issue...

Is there somme steps I missed ? Have I to "add" object code from the "Menu-File" or something else ? Where must be located the object file(s) ?

Warm Regards, Michel