Help: how to export function using makefile in mingw

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help: how to export function using makefile in mingw

angrymailer@qq.com
Hello, everybody :

        i compile a exe file, i want to export some functions.

        the code is :

#define LIBIMOBILEDEVICE_API __declspec( dllexport )

LIBIMOBILEDEVICE_API void print_usage(int argc, char **argv)
{
char *name = NULL;

name = strrchr(argv[0], '/');
printf("Usage: %s [OPTIONS] [UDID]\n", (name ? name + 1: argv[0]));
printf("Prints device name or a list of attached devices.\n\n");
printf("  The UDID is a 40-digit hexadecimal number of the device\n");
printf("  for which the name should be retrieved.\n\n");
printf("  -l, --list\t\tlist UDID of all attached devices\n");
printf("  -d, --debug\t\tenable communication debugging\n");
printf("  -h, --help\t\tprints usage information\n");
printf("\n");
printf("Homepage: <http://libimobiledevice.org>\n");
}

        i run make command, the exe file export nothing.

        i write a simple code, using __declspec( dllexport ), then run gcc, the exe have export function.

        i want to know how to export functions using makefile .

        Thank you !

        



Best Regards

Jackie Ji

Email     : [hidden email]

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Help: how to export function using makefile in mingw

Robert M. Münch
Am 12.03.2015 um 04:13 schrieb [hidden email]:

>         i compile a exe file, i want to export some functions.
> …
>
>         i run make command, the exe file export nothing.

Hi, as the specifier states: DLLexport, not EXEexport. An EXE can’t export a function. Who should make use of it? You need to compile a DLL and than you can control exports via a .DEF file.

--
Robert M. Münch
M: +41 79 65 11 49 6

Saphirion AG

http://www.saphirion.com
smarter | better | faster





------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe

signature.asc (538 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Help: how to export function using makefile in mingw

Eli Zaretskii
> From: "Robert M. Münch" <[hidden email]>
> Date: Thu, 12 Mar 2015 08:56:10 +0100
>
> An EXE can’t export a function.

Of course, it can.  See GNU Make as an immediate example: the latest
versions export several functions.

> Who should make use of it?

An external module that needs to be linked against, and use, those
exported functions.  E.g., in GNU Make, users can implement additional
Make functions and then use them in their Makefile's.

> You need to compile a DLL and than you can control exports via a .DEF file.

You can ask the linker to create a .DEF file or an import library for
a .exe program as well.


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe