Thread: about type casting...

  1. #16
    Registered User
    Join Date
    May 2007
    Posts
    41
    thanks...

    So it's impossible...well...anyway I'm embedding my modules in DLL files. What if, in the host app, I declare

    Code:
    typedef int (WINAPI* LPFUNC_INIT)(void*);
    then in the DLL file I use:

    Code:
    int WINAPI Init(strMyStruct* ptr)
    {
    }
    it should work allright...is it true?

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    No. Never. Absolutely not.
    Types must match, or you get undefined behavior.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    Registered User
    Join Date
    May 2007
    Posts
    41
    but the type of a pointer is only an indication to the compiler on how to handle its arithmetic, isn't it? So why should it not work?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What dose this type casting mean??
    By zhoufanking in forum C Programming
    Replies: 4
    Last Post: 06-11-2008, 06:09 AM
  2. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  3. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM
  4. Erros in Utility Header File
    By silk.odyssey in forum C++ Programming
    Replies: 4
    Last Post: 12-22-2003, 06:17 AM
  5. help with simple type casting problem
    By Jeremy_S in forum C Programming
    Replies: 2
    Last Post: 02-27-2002, 12:38 PM