#### Archived

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

# Quick DLL question

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

## Recommended Posts

Hey A quick and easy one : How can I access something (lets say a struct) that is in a DLL? I mean I have something like this in a DLL :
  typedef struct { int a, b, c; } SOMEDATA; SOMEDATA Some_Data; extern DLL SOMEDATA Some_Data; 
And then I want to access this in my EXE. I tried :
typedef struct
{

int a, b, c;

} SOMEDATA;

extern DLL SOMEDATA Some_Data;

But it gives me an error. Obviously something must be wrong (or no error would appear, right? hehe), but I cant find it as its my 1st try with DLLs. Thanks a lot, -RoTTer (Using 2 (SOURCE) and (/SOURCE)s caused weird results so I had to use one (SOURCE) and one (CODE), sorry) Edited by - RoTTer on 7/12/00 9:10:35 PM

##### Share on other sites
I believe you have to declare the data as export and in the Exe, declare it as import..

##### Share on other sites
Hey

Uhmm.. Im almost copying this DLL thing from another code, and it did it that way... And when I try it the compiler gives me an error =/.

What exactly the "extern DLL" is? Cause it gotta work, as its on the code Im looking (and it compiles perfectly here =/, the only difference I can see is that it is C and my code is C++ eheh).

But if I dont manage to make that work Ill try your import/export . Thanks.

Ah, just curious : What happens if I try to use a var (with extern DLL or import, whatever) and its not in the DLL? Program crashes?

Thanks, and cya,
-RoTTer

##### Share on other sites
You can try searching the MSDN in the dll section. It explains and gives example on how to import/export data in dll.

##### Share on other sites
I''m not sure about the DLL part, but I usually do something like this (so does msdn):

#define DLLEXPORT __declspec( dllexport )
#define DLLIMPORT __declspec( dllimport )

and then use the defines in place of having to remember the rest. It''s probable your DLL is defined as one or the other, and maybe it''s the wrong one.

Mark Fassett
Laughing Dragon Entertainment
http://www.laughing-dragon.com

1. 1
Rutin
28
2. 2
3. 3
4. 4
5. 5

• 13
• 11
• 10
• 13
• 20
• ### Forum Statistics

• Total Topics
632950
• Total Posts
3009424
• ### Who's Online (See full list)

There are no registered users currently online

×