Platform Builder: Cloning – the Linker is your Friend

Posted by Bruce Eitman on Geeks with Blogs See other posts from Geeks with Blogs or by Bruce Eitman
Published on Tue, 23 Mar 2010 19:11:09 GMT Indexed on 2010/03/24 1:23 UTC
Read the original article Hit count: 937

Filed under:
I was tasked this week with making a minor change to NetMsgBox() behavior. NetMsgBox() is a little function in NETUI that handles MessageBox() for the Network User Interface. 
The obvious solution is to clone the entire NETUI directory from Public\Common\Oak\Drivers (see Platform Builder: Clone Public Code for more on cloning). If you haven’t already, take a minute to look in that folder. There are a lot of files in the folder, but I only needed to modify one function in one of those files. There must be a better way.
Enter the linker.
Instead of cloning the entire folder, here is what I did:
  1. Create a new folder in my Platform named NETUI (but the name isn’t important)
  2. Copy the C file that I needed to modify to the new folder, in this case netui.c
  3. Copy a makefile from one of the other folder (really they are all the same)
  4. Run Sysgen_capture
    1. Open a build window (see Platform Builder: Build Tools, Opening a Build Window)
    2. Change directories to the new folder
    3. Run “Sysgen_capture netui”
    4. Rename sources.netui to sources
  5. Add the C file to sources as SOURCES=netui.c
  6. Modify the code
  7. Build the code
  8. Done
That is it, the functions from my new folder now replace the functions from the Public code and link with the rest to create NETUI.dll.
There is a catches. If you remove any of the functions from the C file, linking will fail because the remaining functions will be found twice.
 
Copyright © 2010 – Bruce Eitman
All Rights Reserved

© Geeks with Blogs or respective owner