Author Topic: Using DEF Files with DLL Creation  (Read 13179 times)

Offline BigAngryDog

  • Multiple posting newcomer
  • *
  • Posts: 75
    • BigAngryDog.com
Using DEF Files with DLL Creation
« on: March 13, 2006, 10:04:35 am »
How does one link in a def file when creating a DLL?

Currently, my def file doesn't seem to have any effect. I particularly want to use it to remove function name decoration.

For example:

Code
LIBRARY test.dll

EXPORTS
    get_url = get_url@12
    get_urlW = get_urlW@12

Any help appreciated. :)
BigAngryDog.com

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Using DEF Files with DLL Creation
« Reply #1 on: March 13, 2006, 10:44:45 am »
Hello,

It would be useful if you say which compiler you are using and which C::B version :). Anyway, this link could be useful.

Best wishes,
Michael

Offline BigAngryDog

  • Multiple posting newcomer
  • *
  • Posts: 75
    • BigAngryDog.com
Re: Using DEF Files with DLL Creation
« Reply #2 on: March 13, 2006, 10:58:50 am »
Version 1.0 RC2.

Thanks for the reply. However, it doesn't seem that the link has the info I need. It talks of a "dlltool" for creating import libraries. However, it isn't an import library I need. I specifically want to remove the name decoration with the __stdcall calling convention.

I understand that I can do it by adding aliases to a def file. So that:

get_url = get_url@12

But how do I "link in" the def file so that the aliases appear in the export table of the DLL?

I'm not an expert with MingGW from the command line. Is there any way I can add the option to C::B?
BigAngryDog.com

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Using DEF Files with DLL Creation
« Reply #3 on: March 13, 2006, 11:26:04 am »
Try adding the following in your target's other linker options:

--def test.def
EDIT: if the above doesn't work, try -Wl,--def=test.def

(replacing "test.def" with your def's filename)
« Last Edit: March 13, 2006, 11:37:50 am by mandrav »
Be patient!
This bug will be fixed soon...

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Using DEF Files with DLL Creation
« Reply #4 on: March 13, 2006, 11:34:58 am »
Version 1.0 RC2.

You would might be give a try to a nightly build :).

Thanks for the reply. However, it doesn't seem that the link has the info I need. It talks of a "dlltool" for creating import libraries. However, it isn't an import library I need. I specifically want to remove the name decoration with the __stdcall calling convention.

I understand that I can do it by adding aliases to a def file. So that:

get_url = get_url@12

But how do I "link in" the def file so that the aliases appear in the export table of the DLL?

I'm not an expert with MingGW from the command line. Is there any way I can add the option to C::B?

I am not an expert too, but may be this link could help.

Best wishes,
Michael

Offline BigAngryDog

  • Multiple posting newcomer
  • *
  • Posts: 75
    • BigAngryDog.com
Re: Using DEF Files with DLL Creation
« Reply #5 on: March 14, 2006, 12:58:19 am »
>You would might be give a try to a nightly build

I just have. Thanks!


>Try adding the following in your target's other linker options:

>--def test.def
>EDIT: if the above doesn't work, try -Wl,--def=test.def

Will do. Thanks!
BigAngryDog.com

Offline BigAngryDog

  • Multiple posting newcomer
  • *
  • Posts: 75
    • BigAngryDog.com
Re: Using DEF Files with DLL Creation
« Reply #6 on: March 14, 2006, 03:29:41 am »
>--def test.def
>EDIT: if the above doesn't work, try -Wl,--def=test.def

Didn't work, but helped me know what sort of thing to look for. Thanks.

So for anyone else looking to build a dll using the __stdcall (WINAPI) calling convention, without the name decoration MinGW (GCC) adds, then put this in CodeBlocks' "Other Linker Options":

Code
-Wl,--kill-at
BigAngryDog.com

grandzebu

  • Guest
Re: Using DEF Files with DLL Creation
« Reply #7 on: May 22, 2006, 03:51:49 pm »
What a very goog information : -Wl,--kill-at is THE solution
Thank's a lot
GZ