Comments (3)
i've been playing around with the code and i got things working, but i am not a hundred percent sure i am not breaking anything. my changes are in safe cast, to me it looks like the issue is that since my other class contains a member that is first in the fields array it breaks and return false without checking if the expected fields are included.
this seems to work fine in what little tesiting i've done
case HVIRTUAL:
if( to->virt->nfields < t->virt->nfields ) {
int i, j;
int matches = 0;
for(i=0;i<to->virt->nfields;i++) {
hl_obj_field *f2 = to->virt->fields + i;
for(j=i; j < t->virt->nfields;j++) {
hl_obj_field *f1 = t->virt->fields + j;
if( f1->hashed_name == f2->hashed_name && hl_same_type(f1->t,f2->t) ) {
matches++;
break;
}
}
}
if( matches == to->virt->nfields )
return true;
}
break;
````
from hashlink.
from hashlink.
just adding this for some more context, to maybe help find a different root causeof my problem.
if i add this to hl_safe_cast
if (t->kind == HOBJ && to->kind == HVIRTUAL) {
vdynamic * d = *(vdynamic**)t->obj->global_value;
vvirtual* conv = hl_to_virtual(to, d);
return hl_safe_cast(conv->t, to);
}
(must of course be before this line to have any effect)
if( t->kind != to->kind )
return false;
the typedef example also runs just fine, but it feels more like the issue is related to hl_to_virtual
and what effect null values for fields ( hl_vfields(v)[i] = NULL;
) has to the later execution.
before i modified the HVIRTUAL case in hl_safe_cast hl_to_virtual would set the field to NULL and this some how made the code try to execute a different method, maybe some kind of index missmatch between the real object type and the interface.
without the code above, the typdef seems to get the same problem, hl_vfields(v)[i] = NULL, and later on it throws an Access Violatio error.
from hashlink.
Related Issues (20)
- Can't run any .hl file on Mac M1 - Segmentation Fault HOT 2
- Unexpected value conversion when using an abstract class with type param
- Any way to get hl.Bytes from an hl.NativeArray? HOT 1
- Single and hl.F32 function args for callMethod stack issue HOT 1
- With SDL backend on Windows, adding an element to a SpriteBatch can cause a large lag spike HOT 2
- src/module.c(567) : FATAL ERROR : Failed to load function sdl@gl_polygon_offset HOT 3
- Macbook M1 Support HOT 2
- Unable to build C output on Windows gcc HOT 4
- Hashlink access violation/segfault, when abstract is used as inerface HOT 11
- Warnings when compiling mysql module (implicit declaration of function `gethostbyname_r`) HOT 3
- `profile.c` caused build regression HOT 1
- Arguments misbehaving on nightly HOT 1
- Unexpected implicit cast to Int, from `abstract(Null<Int>)` HOT 2
- Versioning libhl.so file on Linux HOT 4
- hashlink\src\module.c(567) : FATAL ERROR : Failed to load function sdl@gl_has_extension HOT 2
- Class<sdl.Sdl> has no field setGLVersion HOT 2
- 32 bit JIT error with nightly haxe HOT 1
- Building from source fails on Linux because of SQLite pointer error. HOT 2
- Issues with the release Task in Makefile HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hashlink.