Create DLL for other languages


Hi all,

I have some DLLs generated by C10. They work perfectly fine when called from other Clarion programs. However, if I call the same DLLs from NodeJS, they don’t seem to work, the calling program shuts down. Any idea?

My clarion app:

tester(STRING, LONG),BYTE,NAME(‘tester’)

tester FUNCTION(inString, inLong)

ReturnValue BYTE(1)


message('Inside DLL: ' & inString & ' / ' & inLong)

RETURN ReturnValue


This is not so simple. At least your export function must have explicit calling convention C or PASCAL.
STRING type is not a good choice for parameters, use (*CSTRING) instead.
Also I suspect that Clarion runtime should be linked to the dll or be placed in same folder.
Also read AttachThreadToClarion topic in the help.


Pascal calling convention is preffered (because Windows API uses it).
Also you must avoid cross-calling, for example Clarion - NodeJS - Clarion or NodeJs Clarion - NodeJS. And a lot of other things… :slight_smile:
I agree with Mike_Duglas: this is not so simple…


Should also use the NAME attribute to get around name mangling.


Thanks all for your hints, I figured it out now.

proc_name(LONG),C,NAME(‘proc_name’) !accepting the address of a cString from other programs

proc_name PROCEDURE(adr_CString)


mystr &= (adr_CString)


If you add a parameter for the length, you can do something like this:

mystr &= (adr_CString) & ‘:’ & Length

Otherwise, you can run into trouble on some functions.