许多“不兼容的签名” 在 Windows 上会出现错误,但在使用 Flex 4 Gumbo 的 Mac OS X 上不会出现错误

发布于 2024-07-27 04:02:12 字数 1802 浏览 1 评论 0 原文

我有一个纯 Action Script 3 项目,正在使用 Flex 4 SDK 进行编译。 我有一个标准 Makefile,它会根据需要自动调用 compc、mxmlc 和 asdoc。 该项目在我的 Mac OS X 10.4+ 计算机上编译干净,没有错误或警告; 然而,当与在 Windows XP(安装了 Cygwin)上开发的同事共享它时,他收到了一个非常大的“不兼容签名”错误列表。 他为什么会出现这些错误? 签名似乎并不不兼容。

注意:有问题的签名是“原始”和“导出”,使用方式如下:

public interface AbstractX
{
    function original() : Object;
    function export() : Object
}
public class ImportX implements AbstractX
{
    public ImportX(obj : Object) {
        _loadedobj = obj;
        _exportobj = obj.export();
    }

    public static function wrap(obj : Object) : AbstractX {
        var result : AbstractX = null;
        if ( obj != null ){
            if ( obj is AbstractX ){
                result = obj as AbstractX;
            }else if ( obj.original() is AbstractX ){
                result = obj.original() as AbstractX;
            }else{
                result = new ImportX(obj);
            }
        }
        return result;
    }

    public function original() : Object {
        return _loadedobj;
    }

    public function export() : Object {
        return _exportobj;
    }

    private var _loadedobj : Object = null;
    private var _exportobj : Object = null;
}
public class X implements AbstractX
{
   public function X() : void {
      //...
   }

   public function original() : Object {
       return this;
   }

   public function export() : Object {
       if ( ! _export ){
           _export = new ExportX(this);
       }
       return _export;
   }

   private var _export : Object = null;
}

注意:上面的代码是我的解决方案的一部分 如何制作在两个 SWF 文件中使用的 Action Script 3 类,当一个 SWF 动态加载另一个 SWF 时解析为同一个类?

I have a pure Action Script 3 project which I am compiling with the Flex 4 SDK. I have a standard Makefile which automatically invokes compc, mxmlc, and asdoc as appropriate. The project is compiling cleanly with no errors or warnings on my Mac OS X 10.4+ computer; however, when sharing it with a coworker developing on Windows XP (with Cygwin installed), he gets a very large list of "incompatible signature" errors. Why is he getting those errors? The signatures don't appear to be incompatible.

NOTE: The signatures in question are "original" and "export", used like this:

public interface AbstractX
{
    function original() : Object;
    function export() : Object
}
public class ImportX implements AbstractX
{
    public ImportX(obj : Object) {
        _loadedobj = obj;
        _exportobj = obj.export();
    }

    public static function wrap(obj : Object) : AbstractX {
        var result : AbstractX = null;
        if ( obj != null ){
            if ( obj is AbstractX ){
                result = obj as AbstractX;
            }else if ( obj.original() is AbstractX ){
                result = obj.original() as AbstractX;
            }else{
                result = new ImportX(obj);
            }
        }
        return result;
    }

    public function original() : Object {
        return _loadedobj;
    }

    public function export() : Object {
        return _exportobj;
    }

    private var _loadedobj : Object = null;
    private var _exportobj : Object = null;
}
public class X implements AbstractX
{
   public function X() : void {
      //...
   }

   public function original() : Object {
       return this;
   }

   public function export() : Object {
       if ( ! _export ){
           _export = new ExportX(this);
       }
       return _export;
   }

   private var _export : Object = null;
}

NOTE: The code above is part of my solution to How do I make an Action Script 3 class, used in two SWF files, resolve to the same class when one SWF dynamically loads the other?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

歌入人心 2024-08-03 04:02:13

您确定它也可以在 Mac OS X 上编译吗? 如果您最近更改了构建脚本,但正在使用“增量”编译器选项,则可能仅仅因为缓存的构建而在 Mac 上成功构建。 尝试删除所有 *.cache 文件并在 Mac 上重建,看看是否出现相同的错误。

可能会出现奇怪的“不兼容签名”错误的一种方法是将输出目录放在库路径中; 例如,如果您将 *.swc 文件输出到 $(MANFOLDER)/lib 中,并且库路径中还列出了 $(MANFOLDER)/lib 。 我怀疑其原因是,最初,将使用代码中的接口,但在构建过程中,将使用(不兼容的)编译接口。

Are you sure it also compiles on Mac OS X? If you recently changed your build scripts but you are using the "incremental" compiler option, it might be building successfully on your Mac simply because of the cached build. Try removing any *.cache files and rebuild on your Mac to see if you get the same errors.

One way that you can get strange "incompatible signature" errors is if you place your output directory in the library path; for example, if you are outputting a *.swc file into $(MAINFOLDER)/lib and you also have $(MAINFOLDER)/lib listed in your library path. I suspect the reason for this is that, initially, the interfaces in your code will be used, but halfway through the build, the (incompatible) compiled interfaces will be used.

哭泣的笑容 2024-08-03 04:02:13

我没有看到任何问题...签名完全兼容...在我的机器上编译得很好,WinXP 的gumbo ...除了它应该是公共函数 ImportX ...和ExportX 未知......如果他尝试手动编译会发生什么? 并不是说我认为错误来自 cygwin 或 makefile,但是现在谁...您可能想使用 ANT,因为这是跨平台的...阅读更多 这里(第 4 页实际上是有趣的地方)...

我认为问题出在其他地方...或者也许发布他的编译输出在这里...

编辑:好的,那么你绝对应该发布他的编译器输出,因为我不明白为什么它不能编译...

但有一个注释< /em>:我现在读了你的注释,关于你打算做什么...我认为它不会起作用,事实上...你会遇到同样的问题,因为你想跨 2 个 swf 共享一个接口...实现一个接口实际上并不简单地意味着您实现了方法,而是意味着,特征对象知道它实现了它的接口...所以您会得到相同的错误...

greetz

back2dos

i don't see any problem ... sigs are completely compatible ... compiles fine on my machine, with gumbo for WinXP ... except it should be public function ImportX ... and ExportX is unknown ... what happens, if he tries to compile that manually? not that i would think that errors come from cygwin or the makefile, but who nows ... you might wanna use ANT though, since this is cross platform ... read more here (page 4 is where it get's interesting in fact) ...

i think the problem is elsewhere ... or maybe post his compile output here ...

edit: ok, then you should most definitely post his compiler output, because i don't understand how that can't compile ...

one note though: i read your note now, on what you are intending to do ... i think it won't work, in fact ... you will get the same problem, because you want to share an interface across 2 swfs ... implementing an interface actually does not simply mean you implement the methods, but it means, that the traits object knows it implements its interface ... so you will get the same errors ...

greetz

back2dos

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文