This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Load Library at run time from file (dll)?

I am developing (porting) a CGI web application on a DM642 using the web server in the NDK.

The examples assume one does not have a file-system and shows how to load html pages and CGI functions directly into code.

Our system has a file system, so I modified the NDK Embedded File-system (EFS) to read from our disk.

That should work for HTML files. The problem is the CGI functions.  The EFS examples pass pointers to the functions already in memory.

I want to load the the CGI functions from *.cgi files and have the NDK thread execute them (much the way dll s work on non-embedded systems).

Is this even possible with DSP/BIOS 5.41 (we can only use COEFF)?

If it is how do I go about doing it?

Thanks,

Harry

 

  • Harry,

    It sounds like you need a .cgi file loader.

    I'm not at all familiar with .cgi file formats. Do they contain function load address information?

    If you're able to read the .cgi files in your file system, it should be possible to craft a function that knows how to extract and place the CGI functions contained therein.

    Alan

  • It is the "should be possible" part of that statement I need help with.

    How do I compile and link code using CCS (compiler = C6000 7.3.7) to create a binary code file that I can label *.cgi, and then how do I read the bytes in and place them in memory and find the function pointers to execute them?

    I am hoping someone had done this or something similar before and can tel me:

    You need to compile with flags -x -y and -z and link with flags -a -b -c then the resulting HelloWorld.cgi file can be read byte by byte into malloced memory and use the X technique to find the byte offsets into malloced memory buffer to find the pointer to the functions to run.

    I need to find out what X, Y, Z; A, B, C and X technique are to get this going.

    Any  Ideas?

    I am looking through the compiler documentation but nothing is jumping out at me.

  • I don't know of a fully productized solution for you, but this is probably the closest you're going to come to .dll support:

        http://processors.wiki.ti.com/index.php/C6000_Dynamic_Loader

    I think it requires you use ELF files (not COFF).  And as the incompleteness at the end of that article hints at, I'm not sure it's fully productized; so you're likely to find some headaches if you go that route.  But there is a gforge-based project with a link on that page if you want to explore it.

    Typically .cgi scripts are 'shell' scripts, and BIOS has no shell, so I'm not sure your existing .cgi scripts are going to be well-portable.  So...

    An arguably better solution may be to 'port' those .cgi scripts into their own .c functions which are compiled into your web server and use the NDK's EFS to call those functions - through their fxn pointers as you've already found.

    Chris