On Wednesday, 17 June 2015 at 20:33:04 UTC, Rodney wrote:
On Tuesday, 16 June 2015 at 07:47:21 UTC, Kagamin wrote:
implib works for C calling convention only.

Thank you for your reply.

So if I am understanding correctly (feel free to admit my ignorance):

1. implib is required to generate a dmd compatible import library from an .dll

2. implib only works for C calling convention only

Therefore, D can only call C and D compatible .dll's?

Obviously I am being dumb about something, because learning and playing around with D I have written several windows programs (XP and 7) that call Silverfrost FORTRAN .dll's (please see http://rrroberts.50webs.com/cobindex.htm) using extern (Pascal) {...}. The FORTRAN .dll's were produced by the Silverfrost SLINKER, then produced an .lib file from that .dll using DMD's implib. And I am now doing the same thing with Free Pascal.

And before anyone says COBOL and FORTRAN are dead, COBOL is still widely used in banking back-end applications, and FORTRAN is used in engineering applications.

Again thanks for your reply.

I believe you can declare cdecl wrappers on free pascal or fortran side, so they will have C calling convention and no mangling. For example:

procedure procedure_name(arg : ArgType); cdecl;
*forward arguments to original procedure*

function function_name(arg : ArgType): ReturnedType; cdecl;
*forward arguments to original function*

And then on D side:
extern(C) void procedure_name(ArgType arg);
extern(C) ReturnedType function_na,e(ArgType arg);


Reply via email to