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.

Dynamic linking problem

Other Parts Discussed in Thread: SYSBIOS

Hi,

I'm learning the dynamic linking, I run the unified_ridl demo and the simple hello.dll is loaded and executed well.

Now I want to add a sysbios function in the dll to see if it can be executed correctly. But it cannot generate the dll

my clock.c is below:

  1 #include <stdio.h>
  2 __declspec(dllexport) int start();
  3 __declspec(dllimport) int Clock_getTicks();
  4
  5 int start()
  6 {
  7     unsigned long int time;
  8     time = Clock_getTicks();
  9     printf("System time in clk0Fxn = %lu\n", (unsigned long int)time);
 10     return 1;
 11 }

I try to generate the dll with the command line below,I add the header file's directory of Clock_getTicks and the lib under the same directory. But it still takes as undefined symbol.

1. can I add functions like Clock_getTicks in a dll?

2. How to compile it ?

Thank you!

  • Hi,

    Moved this thread to correct forum for faster response.

    Thank you.

  • Unless SYS/BIOS is available as a dynamic shared object, you need to call Clock_getTicks as a regular function.  That is, don't declare it with dllimport.

  • Thank you Archaeologist,

    I comment out the dllimport. But with the command line below, it only warning about the function and still don't recognize the Clock_getTicks.

    I try to add the header directory but it gets to the same result.

    what should I do?

    Thank you.

  • The version of BIOS I have installed is 6.33.01.25.  When I look at what symbols are defined in the library ti.sysbios.knl.ae66, I do not see any symbol named Clock_getTicks.  I do see a function symbol named ti_sysbios_knl_Clock_getTicks__E.  I do not suggest you call the function by that name.  I'm pretty sure some other method is intended to be used.  I suggest you start a new thread on this topic in the TI-RTOS forum.

    Thanks and regards,

    -George

  • George Mock said:
     When I look at what symbols are defined in the library ti.sysbios.knl.ae66, I do not see any symbol named Clock_getTicks.  I do see a function symbol named ti_sysbios_knl_Clock_getTicks__E.

    Looking at Sys/BIOS 6.40.03.09 ti/sysbios/knl/Clock.h shows the pre-processor macros:

    #define Clock_getTicks ti_sysbios_knl_Clock_getTicks
    #define ti_sysbios_knl_Clock_getTicks ti_sysbios_knl_Clock_getTicks__E

    i.e. a call to the Clock_getTicks function in a C source file which had included Clock.h actually gets re-defined to the function name ti_sysbios_knl_Clock_getTicks__E

  • The right way to get Clock_getTicks is to include <ti/sysbios/knl/Clock.h> and then to use /usr/local/CCSv5/bios_6_31_04_27/packags as an import path. But I also have to say that packaging SYS/BIOS in a DLL could be a complex task and I am not sure if it's even possible.
    The function Clock_getTicks__E is generated as a product of a SYS/BIOS configuration and I don't see anything on the command line that would bring in the generated files.

  • Thanks George, Chester and Sasha,

    What I want to do is to add non C Standard library  functions in dlls.

    I include the Clock.h and add the import path and I get this:

    use the symbol Clock_getTicks or ti_sysbios_knl_Clock_getTicks seems no difference.

    it seems that I will never add header files enough.

    Thank you.

  • As I said in my previous post, there is no really a prescribed way to incorporate SYS/BIOS libraries into a DLL. I don't want to discourage you from trying to that, and if you want you can try this link for the solution for this latest problem: http://rtsc.eclipse.org/docs-tip/Integrating_RTSC_Modules, but the chances are that you will keep finding further issues that no one had to solve before.