-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce7b7a4
commit 7263616
Showing
4 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{.used.} | ||
|
||
import std/typetraits | ||
import mtypetraits_types | ||
import ttypetraits | ||
|
||
proc callbackFun(a: pointer, id: TypeId): string {.exportc.} = | ||
case id | ||
of getTypeid(Foo1): $("custom1", cast[Foo1](a)) | ||
of getTypeid(Foo2): $("custom2", cast[Foo2](a)) | ||
of getTypeid(Foo3): $("custom3", cast[Foo3](a)) | ||
else: | ||
doAssert false, $id | ||
"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
type Foo1* = object | ||
x1*: int | ||
|
||
type Foo2* = object | ||
x2*: int | ||
|
||
import std/typetraits | ||
proc callbackFun(a: pointer, id: TypeId): string {.importc.} | ||
|
||
proc callbackFun*[T](a: T): string = callbackFun(cast[pointer](a), getTypeid(T)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters