1. exe imports / exports and Eu

This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C0E48C.FDC0CFC0
	charset="iso-8859-1"

Hi everyone.

I want to create a "plugin" for the AC3D modeller.

I have never tried anything like this before so these questions might
be a bit lame :)

It looks to me like the AC3D.exe exports most of its internal functions.
These are then made available to the plugin (which I believe is a =
renamed
DLL) to call.=20

I had hoped that I could create my DLL plugin using the Eu2C translator.
However, I cannot think of a way to get my dll to "see" the exported =
AC3D
functions. Is there a way to do it? Perhaps by modifying one of the =
files
created by Eu2C?

Alternatively, could I create a DLL using BCC that I can then call from =
a
Euphoria program, passing my data backwards and forwards through=20
the DLL? (Is this perhaps what Mic has done with his WinAMP plugin?)

Any advice would be greatly appreciated (especially from you guys that=20
have done this DLL thing......Todd, Mic, Ray etc......)

All the best.

Mark

------=_NextPart_000_0009_01C0E48C.FDC0CFC0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi everyone.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I want to create a "plugin" for the =
AC3D=20
modeller.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have never tried anything like this =
before so=20
these questions might</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>be a bit lame :)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>It looks to me like the AC3D.exe =
exports most of=20
its internal functions.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>These are then made available to the =
plugin (which=20
I believe is a renamed</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>DLL) to call. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I had hoped that I could create my DLL =
plugin using=20
the Eu2C translator.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>However, I cannot think of a way to get =
my dll to=20
"see" the exported AC3D</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>functions. Is there a way to do it? =
Perhaps by=20
modifying one of the files</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>created by Eu2C?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Alternatively, could I create a DLL =
using BCC that=20
I can then call from a</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Euphoria program, passing my data =
backwards and=20
forwards through </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>the DLL? (Is this perhaps what Mic has =
done with=20
his WinAMP plugin?)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Any advice would be greatly appreciated =
(especially=20
from you guys that </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>have done this DLL thing......Todd, =
Mic, Ray=20
etc......)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>All the best.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>

------=_NextPart_000_0009_01C0E48C.FDC0CFC0--

new topic     » topic index » view message » categorize

2. Re: exe imports / exports and Eu

Hi Matt.

> You can simply use open_dll().  The name is a little misleading.  Any file
> that exports functions or variables will work with open_dll() (.dll, .exe,
> .ocx, etc).  So writing the dll in Euphoria is your best way to go.

Interesting.....I actually tried that. I must have made a mistake :(

In the meantime,I have been having a rotten time trying to compile a DLL
using BCC from the DOS prompt.. I finally got it to recognise AC3D's
exports when suddenly it has started reporting "out of memory"....sheesh!

The example source and .h is VC++ and as I know little about either VC
or BCC this is very hard. I would rather do it all with Eu if possible....

> However, that's about as far as I can help you, since all the information
on
> creating and using plugins for/with AC3D seems to be reserved for the
> registered version.  With the new dll features, this should be pretty
> simple, although you might have to fiddle with the names of the exported
> files (using a .def file), since I'm guessing that AC3D looks for a
certain
> entry point to access the plugin.

It looks for three specifically named functions. It expects to get values
back
from two of them. I have played around with the .def as suggested in Eu2C
which seemed to fix the names (but left the old names there too.....is there
a reason for that?). Incidently, I think a switch to have the .def
automatically
generated would be nice.

Thanks for the help Matt. Don't be surprised if I end up with lots more
questions :)

Mark

new topic     » goto parent     » topic index » view message » categorize

3. Re: exe imports / exports and Eu

Me again.....last time tonight (this morning! work in 5 hours :(    )

I still can't get the exe to open. It is failing at open_dll.
I tried loading the "sgrid.ocx" from your "EUCom" and 
that loaded fine. I thought perhaps that AC3D.exe 
itself needed the tcl dll's (which I had not copied across
to my code folder) so I copied everything from the
AC3D folder to the folder containing my code but still no
go.

I'll sleep on it.

Mark

new topic     » goto parent     » topic index » view message » categorize

4. Re: exe imports / exports and Eu

Matt wrote.....

> After some testing, here's what I've found.  You can only get access to
> files that are in the same folder, are in subfolders of your code, or are
in
> the system directory.  This appears to be a windows thing.
Still no go I'm afraid. I have done all the things suggested above.

This is my little test code. I have tried it compiled and interpreted.....

include dll.e           -- euphoria include

atom ac3d_exe

ac3d_exe = open_dll("ac3d.exe")  -- attempt to open the AC3D exe

if ac3d_exe = 0 then
    puts(1,"Couldn't open the exe.\n")
    if getc(0) then end if
end if

Could you possibly send me the code you used to open an exe and also
if it isn't too big the exe you used?

There must be something simple I am doing wrong....very frustrating!

Mark

mabrown at senet.com.au

new topic     » goto parent     » topic index » view message » categorize

5. Re: exe imports / exports and Eu

I have just wrapped and atttempted to load the ac3d.exe
via LoadLibraryA.

Still doesn't open but the dll's do.

Is it possible that ac3d can export functions but *not* be
loadable as a dll? If so, what options do I have (link to
ac3d with BCC??)

Mark

new topic     » goto parent     » topic index » view message » categorize

6. Re: exe imports / exports and Eu

Sorry me again!

A bit more info.

I wrapped "GetLastError" to get the error code once the
exe fails to load. It returned error code 6.

>From MSDN this =

6 Library required separate data segments for each task. 

Mark

new topic     » goto parent     » topic index » view message » categorize

7. Re: exe imports / exports and Eu

I wrote....


> From MSDN this =
> 
> 6 Library required separate data segments for each task. 

which I suspect was the wrong table!

I suppose it was probably.....

6 The handle is invalid.  

which isn't very useful :(

Mark

new topic     » goto parent     » topic index » view message » categorize

8. Re: exe imports / exports and Eu

Well, as you've already suggested, you could try writing an addtional 
"layer" in C. That is, write a dll wich operates on ac3d.exe and use this 
dll as the interface for your euphoria program. Dunno if this would solve 
your problems, but hey, it's worth a shot.

new topic     » goto parent     » topic index » view message » categorize

9. Re: exe imports / exports and Eu

Hi Stabmaster

> Well, as you've already suggested, you could try writing an addtional
> "layer" in C. That is, write a dll wich operates on ac3d.exe and use this
> dll as the interface for your euphoria program.

I have had the most success so far compiling a dll using BCC. I was at least
able to link to and get exports from AC3D so that looks promising.
The problem is that the only include and examples supplied with the AC
SDK are in VC and I have already had trouble compiling them under BCC.

Mark

new topic     » goto parent     » topic index » view message » categorize

10. Re: exe imports / exports and Eu

Thanks for the help with this.

I have succeeded in compiling a DLL using BCC and
getting AC3D to plug in to it. There are still some
problems. For example, one exported AC function 
returns an "Unresolved External" or similar when linking.
It links fine if I use "-u-" to turn off the leading underscore
on exported names but then, all the other functions return
the "Unresolved External" !!! I still hate C :(

I'm going to try using the dll to get at AC's data using
Euphoria next. Wish me luck.

Mark

new topic     » goto parent     » topic index » view message » categorize

11. Re: exe imports / exports and Eu

Hi Bernie,


 
>   I downloaded AC3D trial version to take a look at it.
>   I don't see any exported functions in AC3D.EXE ?

Only the registered version can handle plugins. Perhaps
the functions aren't exported on the PD version? 

>   I am totally confused by what you are trying to accomplish.

Me too!  :)

The registered version of AC allows you to get at all of the 
3d object data using those exported functions. 

What I want to do is get at the UV texture data. I have played
around with the AC model file itself, changing some of the UV 
values with a text editor and verified that the texture mapping 
is changed. 

The intention is to write a program something like the 
UV Texture Coordinator in Milkshape to fix the one area of
AC that I don't like which is texture mapping. 

The plugin itself is a dll (renamed to *.p). The plugin *must*
export 3 specific functions that initialise the plugin for use with
AC. A proper plugin would also contain other functions that 
could call further AC functions to get at and manipulate the data.

I thought I might be able to use Eu2C to create my plugin but no go.
I then used BCC to create the dll. That succeeded and AC
recognises the dll as a plugin. So, I figured that if I wrapped all
the AC functions I needed in the plugin dll I could call the plugin
dll from Euphoria to get and change the AC data.

Unfortunately (again!) I have struck a wall as my plugin dll won't
"open_dll" with Euphoria. Sigh.....

Between fighting with BCC via the command line and the
simple fact that I'm bad at C, I may have to concede that this
is beyond me.

Mark

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu