1

Came across the following paragraph from a page on the MySQL website here:

You can write plugins in C or C++ (or another language that can use C calling conventions). Plugins are loaded and unloaded dynamically, so your operating system must support dynamic loading and you must have compiled the calling application dynamically (not statically). For server plugins, this means that mysqld must be compiled dynamically.

What is meant by dynamical compiling? I know about dynamical linking, but I'm not sure what they meant with dynamical compiling.

Also, on Windows 10 (x64), how can I assure that an exe has been compiled dynamically? Is it possible to figure it out from the output of dumpbin? Here's the dumpbin output for mysqld.exe (version 5.7):

enter image description here

Note: I reviewed this old question which did not provide me with that much information. The depends tool it suggests is no longer on Windows.

Sabuncu
  • 5,095
  • 5
  • 55
  • 89
  • 1
    Maybe they are talking about dynamically linked CRT versus statically linked CRT. – drescherjm Jul 05 '17 at 18:17
  • @drescherjm Maybe, that never occurred to me. Thank you. – Sabuncu Jul 05 '17 at 18:20
  • @drescherjm That's an issue if, for example, memory is allocated by the plugin but then freed by the application, or vice versa. If you don't cross the boundary that way, you *should* be okay statically linking to the CRT. – David Schwartz Jul 05 '17 at 18:25
  • @DavidSchwartz I want to ask about the details/implications of the issue you just described, but don't want to wear out my welcome! – Sabuncu Jul 05 '17 at 18:28

1 Answers1

2

Compiling dynamically simply means that you are compiling the code such that the compiled output is suitable for dynamic linking.

On Windows, the process of creating as DLL necessarily compiles it such that it's suitable for dynamic linking because DLLs are always dynamically linked.

I believe that most platforms today always compile dynamically and produce relocatable output, even if they're subsequently linked statically.

David Schwartz
  • 179,497
  • 17
  • 214
  • 278
  • Thank you. Can this property be discovered for an *exe*, not a DLL? – Sabuncu Jul 05 '17 at 18:14
  • 1
    I am not 100% sure, but I believe that modern Windows platforms *always* compile dynamically. That means that every modern Windows executable is suitable for being dynamically linked to by another executable if you wish to do so, that is, can be loaded like a DLL is by another executable. – David Schwartz Jul 05 '17 at 18:15
  • In the screen capture I included, dumpbin reports DLL characteristics although the file is an exe. Could that be clue one way or another? – Sabuncu Jul 05 '17 at 18:16
  • 2
    @Sabuncu I believe that's because on modern Windows platforms, the differences between EXEs and DLLs are surprisingly minor. A DLL can't be launched directly, but that's practically the only difference. – David Schwartz Jul 05 '17 at 18:17
  • Thank you so much. Your answers provide me w/ the necessary foundation for further research. – Sabuncu Jul 05 '17 at 18:18