20 December 2012

header file and library(dll) yg perlu utk compile C

Masih keliru berkenaan header file dan library(samada dll atau libfoo.a) yang perlu ketika nak compile aturcara c

Di bawah adalah diskusi yg disedut dari http://mingw-users.1079350.n2.nabble.com/Win-API-documentation-td7302962.html.

-------- mail n -------------------------------------------------------
> For instance, the SafeArrayCreate function described at:
>
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms221234%28v=vs.85%29.aspx
>
> Is that part of the core windows API?

Yes. If you read the document at that URI, it tells you which headers
to #include, which libraries with which to link, and which DLLs are
required at run time. So...

1) Check that MinGW provides the required header(s), (in c:\mingw\include
for a standard installation).

2) Check that the symbols you need to reference are defined, and that
functions you wish to call are declared, in the appropriate MinGW header;
(some are incomplete, due to inadequate documentation from Microsoft).

3) Check that MinGW provides the requisite libraries; (where Microsoft say
to use foo.lib, you look for libfoo.a or libfoo.dll.a, in c:\mingw\lib).

4) Check that the *system* provides the requisite DLLs; (most often, you
will find them in c:\windows\system32).

If all four checks pass, you should be able to use that API, without recourse
to any other resource.


----- mail n+1 -------------------------------------------------------------
> 3) Check that MinGW provides the requisite libraries; (where Microsoft say
> to use foo.lib, you look for libfoo.a or libfoo.dll.a, in c:\mingw\lib).

As an aside, isn't it true that current versions of the GNU linker can
link directly against the DLL, even if the import library libfoo.dll.a
is not available?


------mail n + 2 ---------------------------------------------------------------------
It is. You need to add the directory with .dll files to the linker path.

No comments:

Post a Comment

Terima kasih