Tk Wrapper Sample

Sample Overview

This sample assembly illustrates wrapping a dynamic link library (DLL) implemented in C.  It also allows access to some rudimentary user interface functionality across platforms.

Sample Source and Build Output Locations

The sample source is found in sscli\samples\pigui\tk.

The sources files are:

Due to a limitation in the way delegates interact with platform invoke, C-implemented APIs that use the cdecl calling convention and require callbacks are not supported in C#. This sample illustrates a way to resolve this issue.  It uses a custom attribute to annotate the desired interop delegate declarations.  The C# code is then compiled into an assembly.  That assembly is then disassembled into CIL using the CIL Disassembler tool. This CIL text is then parsed using the custom attribute as a tag for modification by the Perl script in:

callconvhack.pl

The modified CIL is then recompiled into an assembly using the CIL Assembler tool.

The build output location is %TARGETCOMPLUS%\samples\pigui.  The output file is an assembly named sharedsourcecli.tk.dll.

Building the Sample

All samples are built from the buildall script. 

You can also build all the samples by switching to the root of the sample directory, sscli\samples, and typing build -c.

You can build this specific sample by switching to the sample directory and typing build -c.

Running the Sample

This sample creates an assembly that is used by the PIGUI Hello sample and the pigpad sample.


Copyright (c) 2002 Microsoft Corporation. All rights reserved.