1
votes

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.

1
Are you trying to create a named alias for the function? What is your actual use case? (Add it to your question, not as a comment) - greatwolf
I think I solved it, when I will try it I will post the whole thing. - user2443423
is Double from another dll module? You cannot make alias for symbols that reside in another dll. - greatwolf
Yes, it is :( In the other case it will be easily solved - user2443423
It's better if you explain what it is you're trying to solve. Why do you think you need to do something like this? - greatwolf

1 Answers

0
votes

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.