@@ -478,7 +478,7 @@ bool MCForeignValueCreate(MCTypeInfoRef p_typeinfo, void *p_contents, MCForeignV
478478 t_value))
479479 return false ;
480480
481- if (!t_resolved_typeinfo -> foreign . descriptor . copy (p_contents, t_value + 1 ))
481+ if (!t_resolved_typeinfo-> foreign . descriptor . copy (&t_resolved_typeinfo-> foreign . descriptor , p_contents, t_value + 1 ))
482482 {
483483 MCMemoryDelete (t_value);
484484 return false ;
@@ -505,7 +505,7 @@ bool MCForeignValueCreateAndRelease(MCTypeInfoRef p_typeinfo, void *p_contents,
505505 t_value))
506506 return false ;
507507
508- if (!t_resolved_typeinfo -> foreign . descriptor . move (p_contents, t_value + 1 ))
508+ if (!t_resolved_typeinfo-> foreign . descriptor . move (&t_resolved_typeinfo-> foreign . descriptor , p_contents, t_value + 1 ))
509509 {
510510 MCMemoryDelete (t_value);
511511 return false ;
@@ -533,7 +533,7 @@ bool MCForeignValueExport(MCTypeInfoRef p_typeinfo, MCValueRef p_value, MCForeig
533533 return false ;
534534
535535 if (t_resolved_typeinfo->foreign .descriptor .doexport == nil ||
536- !t_resolved_typeinfo->foreign .descriptor .doexport (p_value, false , t_value + 1 ))
536+ !t_resolved_typeinfo->foreign .descriptor .doexport (&t_resolved_typeinfo-> foreign . descriptor , p_value, false , t_value + 1 ))
537537 {
538538 MCMemoryDelete (t_value);
539539 return false ;
@@ -559,7 +559,7 @@ void __MCForeignValueDestroy(__MCForeignValue *self)
559559 MCTypeInfoRef t_resolved_typeinfo;
560560 t_resolved_typeinfo = __MCTypeInfoResolve (self -> typeinfo);
561561
562- t_resolved_typeinfo -> foreign . descriptor . finalize (self + 1 );
562+ t_resolved_typeinfo-> foreign . descriptor . finalize (self + 1 );
563563
564564 MCValueRelease (self -> typeinfo);
565565}
@@ -570,7 +570,7 @@ hash_t __MCForeignValueHash(__MCForeignValue *self)
570570 t_resolved_typeinfo = __MCTypeInfoResolve (self -> typeinfo);
571571
572572 hash_t t_hash;
573- if (!t_resolved_typeinfo -> foreign . descriptor . hash (self + 1 , t_hash))
573+ if (!t_resolved_typeinfo-> foreign . descriptor . hash (&t_resolved_typeinfo-> foreign . descriptor , self + 1 , t_hash))
574574 return 0 ;
575575 return t_hash;
576576}
@@ -581,7 +581,7 @@ bool __MCForeignValueIsEqualTo(__MCForeignValue *self, __MCForeignValue *other_s
581581 t_resolved_typeinfo = __MCTypeInfoResolve (self -> typeinfo);
582582
583583 bool t_result;
584- if (!t_resolved_typeinfo -> foreign . descriptor . equal (self + 1 , other_self + 1 , t_result))
584+ if (!t_resolved_typeinfo-> foreign . descriptor . equal (&t_resolved_typeinfo-> foreign . descriptor , self + 1 , other_self + 1 , t_result))
585585 return false ;
586586
587587 return t_result;
@@ -592,11 +592,12 @@ bool __MCForeignValueCopyDescription(__MCForeignValue *self, MCStringRef& r_desc
592592 MCTypeInfoRef t_resolved_typeinfo;
593593 t_resolved_typeinfo = __MCTypeInfoResolve (self->typeinfo );
594594
595- bool (*t_describe_func)(void *, MCStringRef &);
595+ bool (*t_describe_func)(const MCForeignTypeDescriptor*, void *, MCStringRef &);
596596 t_describe_func = t_resolved_typeinfo->foreign .descriptor .describe ;
597597
598598 if (NULL != t_describe_func)
599- return t_describe_func (MCForeignValueGetContentsPtr (self),
599+ return t_describe_func (&t_resolved_typeinfo->foreign .descriptor ,
600+ MCForeignValueGetContentsPtr (self),
600601 r_description);
601602 else
602603 return MCStringFormat (r_description, " <foreign: %p>" , self);
@@ -691,40 +692,40 @@ bool defined(void *contents)
691692}
692693
693694template <typename TypeDesc>
694- bool equal (void *left, void *right, bool & r_equal)
695+ bool equal (const MCForeignTypeDescriptor* desc, void *left, void *right, bool & r_equal)
695696{
696697 r_equal = *static_cast <typename TypeDesc::c_type *>(left) == *static_cast <typename TypeDesc::c_type *>(right);
697698 return true ;
698699}
699700
700701template <typename TypeDesc>
701- bool copy (void *from, void *to)
702+ bool copy (const MCForeignTypeDescriptor* desc, void *from, void *to)
702703{
703704 *static_cast <typename TypeDesc::c_type *>(to) = *static_cast <typename TypeDesc::c_type *>(from);
704705 return true ;
705706}
706707
707708template <typename TypeDesc>
708- bool move (void *from, void *to)
709+ bool move (const MCForeignTypeDescriptor* desc, void *from, void *to)
709710{
710- return copy<TypeDesc>(from, to);
711+ return copy<TypeDesc>(desc, from, to);
711712}
712713
713714template <typename TypeDesc>
714- bool hash (void *value, hash_t & r_hash)
715+ bool hash (const MCForeignTypeDescriptor* desc, void *value, hash_t & r_hash)
715716{
716717 r_hash = TypeDesc::hash_func (*static_cast <typename TypeDesc::c_type *>(value));
717718 return true ;
718719}
719720
720721template <typename TypeDesc>
721- bool describe (void *contents, MCStringRef& r_string)
722+ bool describe (const MCForeignTypeDescriptor* desc, void *contents, MCStringRef& r_string)
722723{
723724 return Describe<TypeDesc>::describe (*static_cast <typename TypeDesc::c_type *>(contents), r_string);
724725}
725726
726727template <typename TypeDesc>
727- bool doexport (MCValueRef p_value, bool p_release, void *contents)
728+ bool doexport (const MCForeignTypeDescriptor* desc, MCValueRef p_value, bool p_release, void *contents)
728729{
729730 static_assert (TypeDesc::is_bridgable, " This type is not bridgable" );
730731
@@ -743,7 +744,7 @@ bool doexport(MCValueRef p_value, bool p_release, void *contents)
743744}
744745
745746template <typename TypeDesc>
746- bool doimport (void *contents, bool p_release, MCValueRef& r_value)
747+ bool doimport (const MCForeignTypeDescriptor* desc, void *contents, bool p_release, MCValueRef& r_value)
747748{
748749 static_assert (TypeDesc::is_bridgable, " This type is not bridgable" );
749750 return DoImport<TypeDesc>::doimport (*static_cast <typename TypeDesc::c_type *>(contents),
0 commit comments