Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify the exact ordinals for dll exports in MinGW?

I'm trying to build a DLL with MinGW and I need to augment the exports it is generating. I need to assign specific ordinal numbers to certain exported functions.

I created a .DEF file, but I can't find the option to tell MinGW linker to use it. Is it even possible?

like image 954
rustyx Avatar asked Nov 04 '11 16:11

rustyx


1 Answers

Turned out to be extremely easy. Simply link together with the .def file like so:

gcc obj1.o obj2.o obj.def -shared -omylib.dll

All the ordinals can be listed in the .def file (ordinal @0 doesn't work though, causes a crash of ld).

Example .def file:

EXPORTS  
   Insert   @1  
   Delete   @2  
   Replace  @3  
like image 162
rustyx Avatar answered Nov 15 '22 06:11

rustyx