Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Amadrias

struc dll_export ?

This topic is 6127 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I know how to export a variable, a function and even a class... Now, I truied to export a struct but I just couldn't make it... where in the followed code do you place the __declspec(dllexport) :
    
typedef struct
{
    char name[128];
    int age;
} Person;
[/source}

Thanks,

Amadrias

Edited by - amadrias on January 12, 2002 3:45:35 PM  

Share this post


Link to post
Share on other sites
Advertisement
As far as I can tell, the problem is not that you (your code) are trying to export a struct, but trying to export a typedef, which are "internal" to the code, a bit like a macro substitution, just a renaming.

You can try dropping the typedef and use a plain struct declaration. The C++ standard states that you can use the struct''s ''tag'' (i.e. it''s name) without the struct keyword (which was the reason why people used the typedef trick), while C still requires it.

So people using your DLL in C code would have to write ''struct Person'' while people using C++ would write ''Person''. Alternatively they might themselve do a typedef, or you, yourself, provide it in a header file.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!