Compact 2013 Ebook

15.6 Calling a DLL
Created by djones on 6/18/2013 9:39:43 AM

1. If you haven’t already, create and test the DLL subproject from the Native Code chapter.

2. In the XAML project (MyFirstXamlApp), in MyFirstXamlApp.cpp modify the code following the comment //Get Local Time to:

//Get Local Time
TCHAR dateTime[100];
//_stprintf <-- Comment this function call out
//(dateTime,
//_T("Time  %02d:%02d:%02d Date [DD/MM/YYYY] %02d/%02d/%04d\n"),
//st.wHour,st.wMinute,st.wSecond, st.wDay, 
//st.wMonth, st.wYear
//);
GetTime(dateTime); <-- Add this

Listing 15.8a: Modifications to MyFirstXamlApp.cpp for the DLL

3. In the XAML project (MyFirstXamlApp) add the reference the DLL’s header near the top of MyFirstXamlApp.cpp:

#include "../TimeDLL/TimeDLL.h"

Listing 15.9 Reference to the DLL header in the Winform in application code source file.

4. In XAML application source project file (double-click on the project in Solution Explorer) change the linkage (TARGETLIBS) to include the reference to TimeDLL.lib on a new line:

$(SG_OUTPUT_ROOT)\sdk\lib\$(_CPUINDPATH)\coredll.lib \
..\TimeDLL\obj\$(_TGTCPU)\$(WINCEDEBUG)\TimeDLL.lib

Listing 15.10 Linkage reference to the DLL in the application’s sources file.

Note in sources there needs to be no spaces after \ on the end of lines.
It is the line continuation character.

5. Rebuild the XAML application and test run it. The current time should again be displayed in the textbox.


Next: 15.7 XAML for Windows Embedded Summary

print

Click here to provide feedback and input

  Comments

There is no comment.

Turkish porno izle video site in rokettubeporno izle