Thursday, June 2, 2011

Exploratory Project Separation of Framework from Components Update

Exploratory Project Separation of Framework from Components Update


I discovered how to create a library for the particular Ada component to be used in the link.  The batch file to do the build follows.  As before, the indented lines are really extensions of the previous line.

cd C:\Source\EP\ObjectC
c:\gnatpro\5.04a1\bin\gcc -c -IC:\Source\EP\UserApp\Try7
  -IC:\Source\EP\UserApp\Try7\AppC -IC:\Source\EP\Util
  -IC:\Win32Ada\src -aLC:\Source\EP\ObjectC
  C:\Source\EP\UserApp\Try7\AppC\com_periodic.adb
c:\gnatpro\5.04a1\bin\gcc -c -IC:\Source\EP\UserApp\Try7
  -IC:\Source\EP\Util -IC:\Win32Ada\src -aLC:\Source\EP\ObjectC
  C:\Source\EP\UserApp\Try7\mT-Topic_Periodic.adb
c:\gnatpro\5.04a1\bin\gcc -c -IC:\Source\EP\UserApp\Try7
  -IC:\Source\EP\Util -IC:\Win32Ada\src -aLC:\Source\EP\ObjectC
  C:\Source\EP\UserApp\Try7\mT-Topic_N_to_One_1.adb
C:\gnatpro\5.04a1\bin\ar rc libcom_periodic.a com_periodic.adb
  mT-Topic_Periodic.adb mT-Topic_N_to_One_1.adb
cd C:\Source\EP\UserApp\Try7
c:\gnatpro\5.04a1\bin\gnatmake -c -aLC:\Source\EP\ObjectC -PApp3.gpr
cd C:\Source\EP\ObjectC
c:\gnatpro\5.04a1\bin\gnatbind -x App3.ali
c:\gnatpro\5.04a1\bin\gnatlink App3.ali libapp3.a libcom_periodic.a
  -o App3.exe
pause

The order of the libraries in the gnatlink turns out to be important.  Although the .o files of the Com_Periodic component could be named first in the gnatlink, when put into the libcom_periodic.a library the reference to the library has to follow the libapp3.a library of C code that references the external name declared in Com_Periodic.ads.

No comments: