I did the test using gpc and gp. The conclusion is: wherever is the $L directive, sources are compiled and objects are linked in the same order.
So, may we say this as a matter of personal preference?
Regards,
Pascal Viandier
-----Message d'origine----- De : gpc-owner@gnu.de [mailto:gpc-owner@gnu.de] De la part de Adriaan van Os Envoyé : December 7, 2005 06:35 À : gpc@gnu.de Objet : Re: Best practice to link with C code
Pascal Viandier wrote:
I have a question regarding the way to link a Pascal module to C code. For example, if in the following module:
Module ctest interface;
Export ctests = all;
Procedure MyCProc(I:Integer); external name 'mycproc';
End. { Interface }
Module ctest Implementation;
End; { Implementation }
If mycproc() is implemented in cproc.c, is it better to put {$L cproc.c} in the Interface or in the Implementation Section? Both work, but is a way better than the other?
I didn't check, but you can pass -v and look at the link command line to see if it makes any difference for the order of object files. Let us know the result.
Regards,
Adriaan van Os