# Generic with extern type? \[hxcpp\]

**URL:** <https://community.haxe.org/t/generic-with-extern-type-hxcpp/96>\
**Category:** Haxe\
**Tags:** haxe-cpp, extern, generic\
**Created:** [November 6, 2017, 10:08am UTC](https://community.haxe.org/t/generic-with-extern-type-hxcpp/96 "2017-11-06T10:08:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmitryhryppa](https://community.haxe.org/user_avatar/community.haxe.org/dmitryhryppa/32/1815_2.png) [@dmitryhryppa](https://community.haxe.org/u/dmitryhryppa)\
**Post date:** [November 6, 2017, 10:08am UTC](https://community.haxe.org/t/generic-with-extern-type-hxcpp/96/1 "2017-11-06T10:08:55Z")

</div>

Hey 😉  
Is it possible to use generics with extern types?  
Don’t know why, but it replace `T` with `Dynamic` type.  
Is it a bug or I’m doing something wrong?

```
@:native('NativeObject.h')
extern class NativeObject 
{
    //...
    public function setValue(value:Int):Void;
}

class HaxeObject<T:NativeObject>
{
    private var ref:Pointer<T>; //generated as Pointer<Dynamic>. But I want to get Pointer<NativeObject>
    public function new()
    {
        //...
    }
    
    public function setValue(value:Int):Void
    {
        ref.setValue(value);
    }
}
```

---

<div class="post-metadata">

**Author:** ![dmitryhryppa](https://community.haxe.org/user_avatar/community.haxe.org/dmitryhryppa/32/1815_2.png) [@dmitryhryppa](https://community.haxe.org/u/dmitryhryppa)\
**Post date:** [November 8, 2017, 11:35am UTC](https://community.haxe.org/t/generic-with-extern-type-hxcpp/96/2 "2017-11-08T11:35:22Z")

</div>

Looks like it is a problem not only with extern classes.  
I’ve created issue about this: [Base generic class goes to be Dynamic · Issue #670 · HaxeFoundation/hxcpp · GitHub](https://github.com/HaxeFoundation/hxcpp/issues/670)
