TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: All
from: Darin McBride
date: 2004-05-11 13:19:24
subject: Re: [C] access data in dll

From: Darin McBride 

On May 11, 2004 11:50 am, john j dumas wrote:
> >Worst case scenario is that you'd need to have a function that returns
> >the array which you can then get the proc address of, and then have it
> >return array1's address.
>
> Yes, I was going to make
>   long  foo2( void )              // in dll.cpp
>   {
>        return ( long)&array1;
>   }
>
> and
>
> char *array1[];  // in prog.hpp
>
> array = ( char ** )foo2;
>
> But, I thought there may be a direct way.

Why all the casting?

char** foo2(void) { return array1; }

array = foo2();

You may need to tweak it a bit, but it should work without any casting
whatsoever, *especially* if you export an unmangled C name.

--- BBBS/LiI v4.01 Flag-5
* Origin: Prism's_Point (1:261/38.1)
SEEN-BY: 633/267 270
@PATH: 261/38 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.