DLL重定向导出而不使用def文件(DLL redirect export without using def file)

有没有办法指示MinGW-W64或CodeBlocks项目在def文件中生成这样的行: func2=func1

int __attribute__((dllimport)) Double (int); int __attribute__((dllexport,alias("Double"))) NextDouble(int);

我认为这会工作,但编译器发出错误:

|2|error: 'NextDouble' aliased to undefined symbol 'Double'|

有没有办法绕过别名到链接器?

澄清:

我有一个DLL的导入库,它导出Double。 我正在尝试创建第二个DLL,它将导入Double并导出NextDouble,它将指向导入的Double的地址。 所以我将在def文件中执行NextDouble = Double。 这将导致在dll点导出NextDouble导入Double。

Is there some way to instruct MinGW-w64 or CodeBlocks project to generate line in def file like this: func2=func1

int __attribute__((dllimport)) Double (int); int __attribute__((dllexport,alias("Double"))) NextDouble(int);

I thought this will work but compiler emits error:

|2|error: 'NextDouble' aliased to undefined symbol 'Double'|

Is there some way to bypass alias to linker?

Clarification:

I have one DLL's import library, which exports Double. I am trying to create second DLL which will import Double and export NextDouble which will point to address of imported Double. So the same thing as if I will do NextDouble=Double in def-file. Which will make export NextDouble in dll point to import Double.

最满意答案

这里是预处理器,它可以为-o phase命令行添加字符:

#define first ".section .drectve\n.ascii\" #define last \"" #define addcmd(name) first name last #define cmd(name) asm(addcmd( name )) cmd(thingtoadd)

所以你可以添加任何意味着def文件的东西。

Here it is preprocessor which can add characters to -o phase command line:

#define first ".section .drectve\n.ascii\" #define last \"" #define addcmd(name) first name last #define cmd(name) asm(addcmd( name )) cmd(thingtoadd)

So you can add anything that means the def file too to it.

更多推荐